[Catalyst] Catalyst Unicode

Christian Lackas christian at lackas.net
Fri Jan 31 12:19:14 GMT 2014

* Will Crawford <billcrawford1970 at gmail.com> [140131 07:00]:

Dear Will,

first of all, thanks for your input, also.

> > That said, in my application I have:
> >     my $file = $c->request->param('file');
> >     warn "is_utf8: ", utf8::is_utf8($file), "\n";
> > and see that $file has not been decoded to UTF-8
> If the string has been decoded *from* UTF-8 to Perl's internal
> representation, it's *not* going to be marked as UTF8 internally;

Maybe I am misunderstanding you, however, if I have a text string that I
know contains UTF-8, however, it is not UTF-8 for Perl, yet (is_utf8
false), then I have to use decode() to fix that, right?

This is what Catalyst does (and what I showed in my small example):

    # from Catalyt/Plugin/Unicode/Encoding:
    Encode::is_utf8( $value ) ?
        : $enc->decode( $value, $CHECK );

After this, everything is good, is_utf8 is true and I could happily live
ever after. In theory.

I am just confused that this decoded (which does work as expected,
contrary to my initial thought) does not reach me in 

    my $file = $c->request->param('file');
    warn "is_utf8: ", utf8::is_utf8($file), "\n";

where my parameter is not UTF8, as I need it.
Does prepare_uploads() of C::P::Unicode::Encoding not process all my
parameters automatically for me?
When I add a debug line in the loop of $c->request->{parameters} there I
do see my value comeing in, and leaving as UTF8.


Dr. Christian Lackas, Managing Partner
inviCRO, LLC -- In Imaging Yours
P: +1 617 963 0263, F: +49 2203 9034722, E: lackas at invicro.com
http://www.invicro.com/  http://www.spect-ct.com/

More information about the Catalyst mailing list