But I'm wondering why TT isn't doing the right thing on it's own.
Templates are saved as UTF-8 with a BOM - but they aren't outputed
(nor saved in cache folder) that way.

They're being read as UTF8 templates fine, but the output layer character set isn't required to be the same as the input layer charset. Perl reads the template as utf8 bytes, parses it as characters, and outputs it as bytes. You probably want one of the following 2 cases:

  my $tt = Template->new( ... );
  my $output = '';
  $tt->process( 'template.tt2', {..}, \$output );

This will put your rendered template into $output as characters, and you can output it in the charset you want. Alternatively,

$tt->process( 'template.tt2', {..}, "output.html", { binmode => ":utf8" } );

will output the template to that file as utf8 bytes.

This all works for me locally with v2.14.

tom

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to