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".

In feed templates I surrounded content with FILTER block:

[% FILTER to_utf( charset ) %]
 ...
[% END %]

and of course change first row:

<?xml version="1.0" encoding="utf8"?>

The same conversion could be done with UTF8 text.

Can I use namespace Template::Plugin::MapUTF8 for publishing module on CPAN?

Another possible usage (not the best one, neithertheless...) is
conversion between russian charsets.

[% FILTER from_utf( charset1 ) %][% FILTER to_utf( charset2 ) %]
 ... converting charset2 to charset1 ...
[% END %][% END %]

-- 
Best regards,
Lobanov Igor

[EMAIL PROTECTED]

http://www.template-toolkit.ru - Template Toolkit translations to Russian

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

Reply via email to