[Catalyst] Double encoded UTF8 output

Svilen Ivanov svilen.ivanov at gmail.com
Sat Nov 26 08:32:25 CET 2005


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