[Dancer-users] Follow-up: problems with UTF-8
Alberto Simoes
ambs at perl-hackers.net
Sun Jun 12 21:37:51 CEST 2011
On 12/06/2011 20:33, Mr. Puneet Kishor wrote:
> How silly of me... I should have provided what the actual text should look like. Please see below --
>
> On Jun 12, 2011, at 2:15 PM, Mr. Puneet Kishor wrote:
>
>> using Dancer 1.3051 (that I force-installed because it wouldn't install nicely on Mac OS X) with Apache. The config file says
>>
>> charset: "UTF-8"
>>
>
> 'text' => {
> 'en' => q[a collaborative collection of casestudies],
> 'es' => q[colección colaborativa de estudios ],
> 'pt' => q[uma coleção colaborativa de estudos de caso],
> };
Two questions:
1. Is the source file in UTF8?
2. Is the source file using 'use utf8;'?
Cheers
>
>
>> A simple phrase like "EcoVal: a collaborative collection of casestudies" renders like so in Spanish and Portuguese respectively --
>>
>> • EcoVal: colecci�n colaborativa de estudios
>>
>
>> • EcoVal: uma cole��o colaborativa de estudos de caso
>>
>>
>>
>> In my early days I used to use CGI::Application. I used the following to make sure everything rendered fine
>>
>> sub translate {
>> return encode_entities( decode_utf8( $_[0] ), "^\t\r\n\040-\177 " );
>> }
>>
>> If I use the above with Dancer, it crashes and burn with the following mensaje. It actually doesn't tell me on which which line, in which package, did it find the offending malformed UTF-8 character (as far as I can tell). What should a polyglot do?
>>
>>
>> ----
>> Malformed UTF-8 character (fatal) at (eval 59) line 1.
>>
>> Stack
>> main in /Users/punkish/Sites/ecoval/public/dispatch.cgi l. 15
>> Plack::Runner in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Runner.pm l. 231
>> Plack::Runner in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Runner.pm l. 256
>> Plack::Loader in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Loader.pm l. 83
>> Plack::Handler::CGI in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Handler/CGI.pm l. 37
>> Plack::Component in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Component.pm l. 39
>> Plack::Middleware::StackTrace in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm l. 27
>> Try::Tiny in /usr/local/lib/perl5/site_perl/5.12.1/Try/Tiny.pm l. 67
>> Try::Tiny in /usr/local/lib/perl5/site_perl/5.12.1/Try/Tiny.pm l. 71
>> Plack::Middleware::StackTrace in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/StackTrace.pm l. 27
>> Plack::Component in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Component.pm l. 39
>> Plack::Middleware::Lint in /usr/local/lib/perl5/site_perl/5.12.1/Plack/Middleware/Lint.pm l. 24
>> Dancer::Handler in /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Handler.pm l. 102
>> Dancer::Handler in /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Handler.pm l. 71
>> Dancer::Handler in /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Handler.pm l. 87
>> Dancer::Object in /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Object.pm l. 15
>> Dancer::Error in /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Error.pm l. 34
>> Dancer::Error in /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Error.pm l. 248
>> ----
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
More information about the Dancer-users
mailing list