Hmm, problem not with utf8 output. I think it works. Problem that
source data are in native charset (it could be not utf8) and must be
converted to UTF8 for only task. In other places they must be in
native charset...

Well, if these are simple data structures (scalars, arrays, hashes) I
would convert them inside code but if this is object, function... I
think in this case it is easier to convert data in template with
filter. Another advantage of this approach I can make one call to
filter (surrounding all content in one block). In code possibly I
would need to make a lot of calls. The only equivalent solution in
this case - saving output to variable and converting it. Not sure this
is the best thing in all cases.

On Tue, 21 Dec 2004 09:14:30 +0000, Tom Insam <[EMAIL PROTECTED]> wrote:
> 
> On Dec 20, 2004, at 19:49, Igor Lobanov wrote:
> 
> > Today I met problem with reading our site newsfeed which uses xml with
> > native encoding. I decided to generate newsfeeds in UTF8 charset. The
> > only thing I needed was to add convertion filter "my_charset" ->
> > "utf8". In my scripts I use Unicode::MapUTF8 for such purpose which
> > have 2 function for conversions. So I wrote Template::Plugin::MapUTF8
> > which defines 2 filters "from_utf8" and "to_utf8".
> 
> This really shouldn't be required. Feed TT proper perl strings, and in
> the process() call, set the binmode of the output filehandle to 'utf8',
> and TT will write the right thing (requires very recent TT release,
> though)
> 
> $tt->process( $template, $vars, $output_file, { binmode => "utf8" } );
> 
>

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to