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.

> However, I agree that the option you patch adds is quite convenient.
Thanks :-)

> Care to add some tests for this problem, too?

Sure, apply http://www.xs4all.nl/~ekonijn/html-template-unicode.patch
and have a look at t/04charset.t; this contains tests of katakana,
devangari and cyrillic, provided both in UTF-8 and Latin-5.

Non-ascii in a patch might be tricky; if the patch won't apply cleanly
let me know & I'll post a tarball.

> 
> -Sven

Regards,
Erik



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to