in reply to Bug in Template?
You said
> (using the same dbh call with UTF8 enabled)
This may be "internally decoded perl's utf8". So encode it to external UTF8 before you pass them to Tempalte.
And template#!/usr/bin/perl use strict; use warnings; use Encode qw(encode decode); use Template; my @chars_not_encoded=(); my @chars_encoded=(); #foreach my $code ( hex('3041') .. hex('3096') ){ foreach my $code ( hex('00C0') .. hex('00F0') ){ push @chars_not_encoded, chr($code); push @chars_encoded, encode('utf8', chr($code)) ; }; my $t =Template->new(); #corrupt output $t->process("test.tmpl", {lines=>\@chars_not_encoded}, "log_noenc" ) o +r die $t->error(); #OK $t->process("test.tmpl", {lines=>\@chars_encoded}, "log_enc" ) or die +$t->error();
<html> <head> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +> </head> <body> [% FOREACH item IN lines %] item=#[% item %]#<br> [% END %] </body> </html>
I am also confusing about encoding of Template, And there seems a lot to read for theses troubles(for example Template::Provider::Encoding )... good luck
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bug in Template?
by remiah (Hermit) on Mar 22, 2012 at 00:53 UTC | |
by remiah (Hermit) on Mar 22, 2012 at 03:54 UTC | |
by Anonymous Monk on Mar 22, 2012 at 08:27 UTC | |
by Anonymous Monk on Mar 22, 2012 at 08:33 UTC | |
by remiah (Hermit) on Mar 22, 2012 at 10:58 UTC |