It seems your problem is that your string "Check my å" is not in perl's
internal format (uri_for expects it). Just UTF-8 octets.
Always use utf-8 flagged strings inside your application.

for example, this should work:

The following code:
 $c->redirect(
  $c->uri_for(
    '/login',
    {error_msg => Encode::decode_utf8("Check my å")}
  );
 );

Use 'use utf8' pragma in the module for perl to automatically convert
literals to utf8 strings.

But using such a literals in the source code is very very bad. Better place
it somewhere in TT or configs.

2007/12/21, Knut-Olav Hoven <[EMAIL PROTECTED]>:
>
> The solution to my last problem (attached) brought up a new problem
> regarding
> UTF-8.
>
> = Problem =
>
> The following code:
> $c->redirect(
>    $c::uri_for(
>      '/login',
>      {error_msg => "Check my å"}
>    );
> );
>
> Gives me this URL in my browser:
> http://localhost:3000/login?error_msg=Check+my+%C3%83%C2%A5
>
> Which prints this on my webpage:
> Check my å
>
> The content type of the webpage is UTF-8.
>
>
> = Possible solution =
>
> Remove line 967 from Catalyst.pm (v5.7011):
>           (map {
>               $_ = "$_";
> # THIS ONE              utf8::encode( $_ );
>               # using the URI::Escape pattern here so utf8 chars survive
>               s/([^A-Za-z0-9\-_.!~*'() ])/$URI::Escape::escapes{$1}/go;
>               s/ /+/g;
>               "${key}=$_"; } ( ref $val eq 'ARRAY' ? @$val : $val ));
>
>
> = Questions =
>
> - It works as a solution to me, does it break anything for others?
> - Why is that line there at all?
> - Shouldn't URI::Escape be enough?
>
>
>
> --
> Knut-Olav Hoven
> Systemutvikler               mob: +47 986 71 700
> Linpro AS                    http://www.linpro.no/
>
>
> ---------- Пересланное письмо ----------
> From: Knut-Olav Hoven <[EMAIL PROTECTED]>
> To: The elegant MVC web framework <[email protected]>
> Date: Fri, 21 Dec 2007 17:43:28 +0100
> Subject: [Catalyst] Problem with Catalyst::Plugin::I18N using UTF-8
> There are some problems when translating with Catalyst::Plugin::I18N using
> special unicode characters like "æøå".
>
> It got printed (both in console/debugging) and in web browser) as
> unprintable
> characters (displayed as "?"). Manually changing encoding in Firefox to
> ISO-8859-1 made it look right, but the rest of the page is using UTF-8, so
> this was a no-go solution for me.
>
> The solution I found to this was to change line 65 of
> Catalyst/Plugin/I18N.pm
> (version 0.06), changed the Decode attribute given
> to "Locale::Maketext::Simple" from 1 to 0.
>
> Any particular reason why Decode was 1?
>
> If Decode=>1 is needed for somebody, this should definitely be a
> configurable
> option.
>
>
> Patch attached
>
> --
> Knut-Olav Hoven
> Systemutvikler               mob: +47 986 71 700
> Linpro AS                    http://www.linpro.no/
>
> _______________________________________________
> 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/
>
> _______________________________________________
> 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/
>
>
>
_______________________________________________
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