On Sat, 2007-07-21 at 18:15 +0200, Sven Neuhaus wrote:
> 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?

Hmm, good point.  The proposed patch allows nested includes in say
unicode or latin-5, but does not allow you to include a latin-5
template from within a unicode template.  An "encoding" attribute
for TMPL_INCLUDE would make that possible, but it would be necessary
to define what happens with deeply nested tmpl_includes, where only some
of them have an encoding attribute.  Obviously such constructs are
error-prone in practice and would require quite a few different test
cases in the suite.

Without bug-reports from users that actually try to run such a setup,
I would declare the issue hypothetical and avoid the added complexity.

> Thanks,
> -Sven

Regards,
Erik



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to