On Monday 24 December 2007 11:06:20 Oleg Pronin wrote: > 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.
I wasn't very clear on this, sorry. "Check my å" is not inside the code, it comes from my "po/mo"-files (i18n). It looks actually more like this: $c->redirect( $c->uri_for( '/login', {error_msg => $c->loc("Check my magic")} ); ); po-file (utf8 encoded): msgid "Check my magic" msgstr "Check my å" > > 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 <catalyst@lists.scsys.co.uk> > > 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: Catalyst@lists.scsys.co.uk > > 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: Catalyst@lists.scsys.co.uk > > 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/ -- Knut-Olav Hoven Systemutvikler mob: +47 986 71 700 Linpro AS http://www.linpro.no/
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ List: Catalyst@lists.scsys.co.uk 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/