Using Template Toolkit and UTF-8

Andy Wardley abw at wardley.org
Thu Jan 19 19:25:53 GMT 2006


Steve Sims wrote:
> The "cached" bits I'm talking about above aren't cached templates,  
> they're output from TT - fully processed templates.  This output gets  
> saved to disc so that I can use this stuff for web page generation.   

Aha, now I understand.  As Aaron points out, you need to set ':utf8'
binmode on the output file you create.

Although I see from your other reply that you've already got a solution,
it's worth pointing out that you can get TT to write the output file and 
set the ':utf8' encoding for you.  Like so:

  $tt->process($infile, $vars, $outfile, binmode => ':utf8');

Cheers
A



More information about the london.pm mailing list