Re: [Templates] XML::Simple, encoding, latin1

[prev] [thread] [next] [Date index for 2004/07/21]

From: Gavin Estey
Subject: Re: [Templates] XML::Simple, encoding, latin1
Date: 15:37 on 21 Jul 2004
Oleg Burlaca wrote:
> 
>     [% USE xdoc = XML.Simple(xml_document) %]
>     title: [% xdoc.title.latin1 %]
>                          ^^^^^^

What about a filter:

package Blah::Template::Plugin::ForceEncoding;
use base qw( Template::Plugin::Filter );
sub filter {
    my ($self, $text);
    my $to = $self->{_ARGS}[0] || 'latin1';
    my $u = utf8($text);
    return $u->$to;
}

[% USE latin1 = ForceEncoding 'latin1' %]
[% FILTER $latin1 %]
  title: [% xdoc.title %]
  .. etc ...
[% END %]

Gavin.

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] XML::Simple, encoding, latin1
Oleg Burlaca 09:26 on 21 Jul 2004

Re: [Templates] XML::Simple, encoding, latin1
Gavin Estey 15:37 on 21 Jul 2004

Re[2]: [Templates] XML::Simple, encoding, latin1
Oleg Burlaca 06:40 on 22 Jul 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52