[Israel.pm] Testing Template::Toolkit utf8 handling

Shmuel Fomberg semuelf at 012.net.il
Sat Apr 12 13:12:50 PDT 2008


Shmuel Fomberg wrote:

> I want to test TT utf8 handling. for doing so, I need to prepare a 
> string 'x[% somevar y%]', where 'x[' should together be a utf8 char, and 
> 'y%' should be other char.
> If TT handles utf8 incorrectly, it should be an error. If TT handle it 
> correctly, it should just print it literally.

Still want to test, but I found how to tell TT how to handle data as 
utf8. Can be done writing:
my $template = Template->new({ ENCODING => 'UTF-8' });

and for the CAP::AnyTemplate to make TT do it I wrote:
$self->template->config(default_type => 'TemplateToolkit',
                         TemplateToolkit => { ENCODING => 'UTF-8' });

Of course, nothing of it is documented. uff.

Shmuel.





More information about the Perl mailing list