Yup, here's a script that confirms the damage:

#!perl
use Template;
#use utf8;

my $foo = q{The モーニング娘。 are cool.};

print "Print says: $foo\n";

my $tt = Template->new;
$tt->process(\*DATA, { foo => $foo });

__DATA__

[% foo %] urlencodes to [% foo | uri %]

__END__

If you run it with "use utf8" uncommented, it prints:

Print says: The モーニング娘。 are cool.

The モーニング娘。 are cool. urlencodes to
The%20%E3%83%A2%E3%83%BC%E3%83%8B%E3%83%B3%E3%82%B0%E5%A8%98%E3%80%82%20are%20cool.

If you run it with "use utf8" intact, it print:

Wide character in print at encode_bug.pl line 11.
Print says: The モーニング娘。 are cool.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl/5.8.8/Template/Filters.pm line 283, <DATA> line 1.
Wide character in print at /usr/local/lib/perl/5.8.8/Template.pm line
168, <DATA> line 1.

The モーニング娘。 are cool. urlencodes to The%20%20are%20cool.

As you can see, it does something like s/モーニング娘。//, which can't
be correct.

I'm going to try and fix this, though, now that I know where the problem
is.  In my app, it didn't print a warning, so I didn't know where to
look for problems.  My guess is that something is wonky around line 283
in Template::Filters :) :)

Regards,
Jonathan Rockway

> Yeah, Template::Stash::ForceUTF8 and Template::Provider::Encoding is
> made just to fix that issue. Interesting to hear that TT uri filter
> gets borked by that. Any working code that shows the breakage?
>
> BTW we use Stash::ForceUTF8 and Provider::Encoding on our production
> boxes and they work fine.
>   

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to