I don't normally have TT output directly, but what if you add this?

binmode STDOUT, ':utf8';

On Wed, Sep 22, 2010 at 1:20 PM, Paul Talacko <[email protected]>wrote:

> Hello all,
>
> I've been trying to write a CGI::Application application using Template
> Toolkit for templating.  But I've come across some odd behavior.
>
> My template loads OK, but when the variables contain utf8 characters then
> weird things happen to the either characters in the template or the ones in
> the variables.
>
> This problem is reproducible on my system.  Template::Toolkit  2.22 Perl
> 5.10.1
>
> I've written a little script that demonstrates it and have attached the
> files to this email.
>
> The output is as follows:
>
> ___ Replacing just ASCII ___
> In template file: a à â c ç e é è ê ë i ï o ô u û ù
> Replaced items  : a c e i o u
>
>
> ___ Replacing with explicit unicode character ___
> Wide character in print at /usr/lib/perl5/Template.pm line 163.
> In template file: a à â c ç e é è ê ë i ï o ô u û ù
> Replaced items  : ☺ a à â c ç e é è ê ë i ï o ô u û ù
>
>
> ___ Replacing with written unicode - we are 'use-ing' utf8 ___
> In template file: a à â c ç e é è ê ë i ï o ô u û ù
> Replaced items  : a � � c � e � � � � i � o � u � �
>
> You can see that in the first example the unicode characters in the
> template are output as they should be.  In the second they are not. In the
> third it's the utf8 text in the variables that is coming out all odd.
>
> Has anyone got any ideas what might be going on here?
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
>


-- 
Bill Moseley
[email protected]
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to