TT and UTF8?

Ash Berlin ash_cpan at firemirror.com
Fri Jan 29 14:48:29 GMT 2010


On 29 Jan 2010, at 14:30, Dave Hodgkinson wrote:

> 
> Anyone had issues with TT and UTF8?
> 
> sheriff and theorbtwo have got me a long way down the line but...
> 
> I have a string which is_utf8() and contains weird characters. I 
> restart apache and Mötorhead displays fine. Next time through it's
> Mot�rhead. Printing unpack(H*) shows the right octets in the string.
> 
> A tcpdump shows two byes being sent on the first hit and only one
> on the second.
> 
> Any quick suggestions before I spend tomorrow swearing at this? Am
> I being misled by unpack? And tools I can use to look to see what 
> TT is doing with my apparently perfectly formed UTF8?

General rules i've used in the past:

1) obv make sure your stash data is utf8, not bytes (which it looks like you have)
2) stick a BOM in the .tt file

That seemed to do it for me. There is an ENCODING config var but i never had much luck with it doing anything. As for why it changes from request to request: absolutely no clue on that one. One possible thing to try is to disable any caching that TT is doing and see if its a weird TT/apache clash.

-ash


More information about the london.pm mailing list