Hy!

You should read http://perldoc.perl.org/utf8.html for an explanation how
utf8 works in perl :)

In short:
When you do utf8::decode, on a string form any input (file, http
request, etc..) perl groups the two separate input bytes represented as
two characters in the string "\xC3\xA9" into one utf8 character: "\xE9"
and marks the string as utf8 (so utf8::is_utf8 returns 1).

So utf8::is_utf8 means that the string has multiple bytes in one
character.

Of course $enc->decode() fails to decode the already decoded "\xE9"
again.

You can use that string without calling decode safely.
C::P::Unicode::Encoding will encode it before it gets written to the
output.

If you want to output it to a file, you should call utf8::encode (or
$enc->encode()) on it before.

There is a good page explaining this on the catalyst wiki what is
currently down :( If I remember correctly, this is the proper link:
http://wiki.catalystframework.org/wiki/tutorialsandhowtos/using_unicode

-- 
Eisenberger Tamás <[email protected]>

On Fri, 2011-03-11 at 23:50 +0000, ryan lauterbach wrote:
> Hi,
> 
> I've read some threads about unicode, utf8 and query parameters but I
> don't understand it enough to fix on my own, so apologies for beating
> a dead horse.
> 
> When a URL contains a utf8 character in the query string such as
> ?first_name=K%E9vyn  (where %E9 is é, latin small e with acute),
> Unicode::Encoding barfs with  utf8 "\xE9" does not map to Unicode.
> 
> Now I believe \xE9 is Perl's internal representation of unicode, so it
> is already decoded by the time Unicode::Encoding::prepare_uploads is
> invoked.  However  Encode::is_utf8( $_ ) is not working or not
> appropriate in this instance and $enc->decode() then fails trying to
> decode \xE9.
> 
> I have removed Unicode::Encoding from my app for the time being.  It
> seems this is the base case for unicode in catalyst so I would think
> I'm doing something fundamentally wrong.  All modules are up to date
> as of tdoay.
> 
> Thanks for any help!
> 
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to