Using Template Toolkit and UTF-8

Steve Sims steve at karmamusicgroup.com
Wed Jan 18 17:51:01 GMT 2006


Hey gang,

Hopefully this will be a simple one...

I'm busy experimenting with localising our web site right now.  We  
use Template Toolkit to build all the pages, and to save time we  
cache a load of stuff.  The localisation experiment I'm doing is to  
Korean, so my output is all UTF-8.

The problem I have is that the processed templates that I cache to  
files aren't being treated as UTF-8 by Template Toolkit.  They don't  
get created with a UTF-8 BOM.  As a result I get pages where the  
stuff created on the fly by Template Toolkit is all nicely UTF-8, but  
the cached bits are garbage. :-(

I've tried putting in some perl code into the templates that create  
the cache files to print out the UTF-8 BOM characters, but that seems  
to result in an extra 3 characters appearing before the BOM.  I'm at  
a loss as to how to resolve this right now.

Any ideas?

Steve


More information about the london.pm mailing list