Re: [htmltmpl] HTML::Template support for Unicode
Brought to you by:
samtregar
From: Sven N. <sve...@sv...> - 2007-07-21 16:15:47
|
Erik van Konijnenburg schrieb: > On Fri, 2007-07-20 at 09:58 +0200, Sven Neuhaus wrote: >> Erik van Konijnenburg schrieb: >>> This is to propose for inclusion in HTML::Template a patch that >>> adds unicode support. >>> If the template file happens to contain Unicode already, this breaks: >>> the bytes making up an UTF-8 character are fed to the Latin => unicode >>> transformation, and you end up with characters that are encoded twice. >> I have seen this problem "in the wild", too. >> >>> There are some ways to handle this situation: >> There is another way that is not quite as inconvenient: You can pass a >> filehandle to the constructor: >> >> open($fh, '<:utf8', 'template-file'); >> my $t = HTML::Template->new(filehandle => $fh); > Yep, that would work, provided you don't need include files. Now that you mention it, I guess the TMPL_INCLUDE tag would need an attribute "encoding" to allow mixed setups. Or is that more of a hypothetical scenario? Thanks, -Sven |