[Catalyst] Catalyst Unicode woes ctd.

Matt Lawrence matt.lawrence at ymogen.net
Tue Oct 2 18:27:18 GMT 2007


Matthias Zeichmann wrote:
> hi list,
>
> i built a simple testapp based on what i presumed "best
> practices" in Catalyst for unicode handling were:
> C:P:Unicode in main app; use utf8 in controllers that actually have
> utf8 characters in them, ENCODING => 'utf8' in C:V:TT. also
> charset=utf-8 is explicitly specified in the content-type headers.
>
> still the output is pretty much broken; i got a template with german
> umlauts and an insert directive that inserts another template with
> umlauts
> ------------test4.tt----------------
> ümläüts inserted [%- INSERT ins.tt -%]
> ------------->8--------------------
> ------------ins.tt------------------
> Nö!
> ------------->8--------------------
>
> which yields:
> ------------->8--------------------
> ümläüts inserted Nö!
> ------------->8--------------------
>   

Looks to me like ins.tt contains UTF-8 data but TT is treating it as
iso-8859-1.


There are a few things you can try to remedy this, TT is supposed to
understand BOMs, so you might get the correct behaviour by opening
ins.tt in vim, doing ":set bomb" and then saving it.

Otherwise, setting the default input layer for new handles might do the
trick.

use open ':utf8'; # all handles are utf8 by default

You can also achieve this using perl -C or PERL_UNICODE. See man perlrun.

Matt




More information about the Catalyst mailing list