Five minutes after I sent this email (and preceded from an hour long
googling and testing) I found the problem -- I put "use encoding
'utf8';" and everything worked fine.
Sorry for the inconvenience
2005/11/26, Svilen Ivanov <svilen.ivanov (AT) gmail (DOT) com>:
Hi,
I'm trying to populate TT2 utf8 template with variables which also
contain utf8 characters. After processing with TT2, the static text in
the template looks double encoded to Unicode (utf8::encode) but the
dynamic text (the one that comes from vars) is K.
I use perl 5.8.6, TT 2.14, my perl script is:
#!/usr/bin/perl
use strict;
use utf8;
use Template;
my $template = Template->new({ INCLUDE_PATH ='.' });
$template->process('test.tt', { test ="test" }, '/tmp/x', binmode =':utf8' )
|| die $template->error();
If I don't specify binmode the problem occurs only when I use wide
characters for the value of the var test (if run with latin value
'test', the output of /tmp/x is fine).
Thanks in advance!
P.S. Any share of experience with utf8 templates and utf8 vars would
be appreciated
templates mailing list
templates (AT) template-toolkit (DOT) org