[Catalyst] Re: Double encoded UTF8 output

Svilen Ivanov svilen.ivanov at gmail.com
Sat Nov 26 16:20:23 CET 2005


Actually I solved the problem by putting "use encoding 'utf8'" in
myapp_server.pl (instead in MyApp.pm or MyApp::V::TT). Probably this
will work under mod_perl/apache environment too if I put "use encoding
'utf8' in startup.pl (I haven't tested it though)

The only thing that bothers me is that I still haven't understood the
real cause of the problem...


2005/11/26, Svilen Ivanov:
> Hi,
>
> I'm building a Catalyst app with TT (Catalyst::V::TT) as view. I'm
> trying to populate TT utf8 template(cyrillic) with variables which
> also contain utf8 characters (cyrillic). After processing with the
> request, the static text in the template looks double encoded to
> Unicode (utf8::encode) but the dynamic text (the one that comes from
> vars) is OK. I'm using Cat 5.57, perl 5.8.6 and TT 2.14.
>
> I tried to locate the problem in TT first by creating simple perl
> script and template:
> =========================
> use utf8;
> use Template;
> my $template = Template->new({ INCLUDE_PATH => '.' });
> $template->process('test.tt', { test => "test" }, '/tmp/x', binmode =>
> ':utf8' );
> =========================
> The problem was reproducible but it got fixed when I added "use
> encoding 'utf8';".
>
> However, adding "use utf8" and "use encoding 'utf8';" to MyApp.pm or
> MyApp::View::TT didn't helped - the variables in the template are
> correct UTF8 chars but the static template text is double encoded.
>
> Thanks in advance!
>
> P.S. Any share of experience with utf8 templates and utf8 vars would
> be appreciated.
>



More information about the Catalyst mailing list