Hello packetstormer

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.

#!/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();
And template
<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


In reply to Re: Bug in Template? by remiah
in thread Bug in Template? by packetstormer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.