[Catalyst] View::TT FILTERS and utf-8

apv apv at sedition.com
Sat Dec 24 01:08:28 CET 2005


On Friday, December 23, 2005, at 03:16  PM, A. Pagaltzis wrote:
> * apv <apv at sedition.com> [2005-12-23 22:55]:
>> Yes! Nice going. It does fix them... But surely there is a way
>> to do this per variable without EVAL_PERL on.
>
> Well, it’s only a workaround to see where the bug is. Since the
> TT filters work correctly when the flag is right, they’re not
> buggy.
>
> Where does your data come from?
Both flat files and MySQL with the tables specifically set to utf8.
> If it’s from a file, and you know the file is UTF-8, then you
> should `binmode $fh, ':utf8';` the file handle so perl knows it’s
> reading UTF-8. If it is a database, the database and its DBD need
> to support encodings and you need to make sure the data you put
> in the database is in the correct encoding (the mechanisms vary
> with RDBMS of course, so I can’t give you a good idea).

I was thinking I might need to get the "process" in View::TT
changed to something more like this:
   unless ( $self->template->process( $template, $vars, \$output, 
binmode => ':utf8' ) ) {
But I just tried that and it also made no difference. So, I think you're
right the incoming data is squirrelly.

I just checked and it looks quite different from some of my others in 
Emacs
so something happened with that file... "??"s everywhere instead of
nice "\302\267"s.

> PS.: if you don’t know much about encodings, I suggest you read
> this article to get the gist of how this all hangs together:
Thanks, I will. I understand the concepts but haven't tried to hack
with it before.
>
>     The Absolute Minimum Every Software Developer Absolutely,
>     Positively Must Know About Unicode and Character Sets (No
>     Excuses!)
>     <http://www.joelonsoftware.com/articles/Unicode.html>
>
Thanks again Aristotle!




More information about the Catalyst mailing list