[Catalyst] Url Encoded UTF8 parameters
Stefan
maillist at s.profanter.me
Sat Aug 1 13:31:54 GMT 2015
Hi,
if a URL parameter contains a Unicode character (e.g. www.example.com/?param=%D6lso%DF <http://www.example.com/?param=%D6lso%DF> which stands for param=Ölsoße), the parameter is not correctly parsed as Unicode.
I did the following to test it:
1. Create a new Catalyst App: catalyst.pl UnicodeTest
2. Set Root.pm Controller to correct encoding by adding ‘use utf8;’ at the top of the file
3. Then add the following lines to the Root.pm Controller in the index function (don’t forget to use Data::Dumper):
$c->log->debug(Dumper($c->req->params));
$c->log->debug(Dumper("Ölsoße"));
4. This outputs for the example url: localhost:3000/?param=%D6lso%DF:
[debug] $VAR1 = {
'param' => "\x{fffd}lso\x{fffd}e"
};
[debug] $VAR1 = '\x{d6}lso\x{df}e';
As you can see, the first output only contains one equal character: \x{fffd} which is obviously not the same as it should be: \x{d6}lso\x{df}e
I already tried adding the ‘encoding => 'UTF-8'’ config option, but this didn’t change anything.
Am I missing a specific setting?
My Catalyst version: 5.90097
Perl version: v5.18.2
Thanks for your help!
Stefan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20150801/e13e9695/attachment.htm>
More information about the Catalyst
mailing list