If you're using HTML::Template and need to cope with the unclean half of ISO-8859-1, the standard procedure is to forego "ESCAPE=HTML" and encode the parameter values yourself, probably using HTML::Entities. But retrofitting a big application to do this can really suck. (Our app has over a hundred templates.)
So rather than going down a road that sucked, I modified HTML::Template 2.7 to support an "encode_entities" option. When true, it runs strings through HTML::Entities::encode_entities rather than HTML::Template's limited built-in encoder. This let us get most of the way to ISO-8859-1 support with a one-line change to our webapp:
my $template = HTML::Template->new( filename => $template, cache => 1, global_vars => 1, + encode_entities => 1, );
The patch (with supporting unit tests) is here.
I've proposed the patch on the html-template-users mailing list. If you're on the list and think it's a good idea, please add your support. Or if you think the idea sucks, say so. But if you think we should switch to TT, come see us 3 years ago. :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ISO-8859-1 support for HTML::Template
by BUU (Prior) on Oct 18, 2004 at 22:19 UTC | |
|
Re: ISO-8859-1 support for HTML::Template
by darrellb (Acolyte) on Nov 05, 2004 at 04:15 UTC | |
by dws (Chancellor) on Nov 06, 2004 at 06:28 UTC |