On Wed, 2004-10-20 at 08:23, Dave Meibusch wrote:
> Hi,
> I've found an issue with hashes when a key is a UTF-8 string.
> I have some simple test code:
>
> #!/usr/bin/env perl
> use strict;
> use Template;
> my $tt = Template->new({ INCLUDE_PATH => '.', }) || die
> "$Template::ERROR\n";
> my %hash = ( 'good' => 1234, "bad \x{20AC}" => 4321, );
> my $vars = {
> hash => \%hash,
> };
> $tt->process('template.tt', $vars) || die $tt->error(), "\n";
>
>
> template.txt:
> Start [% component.name %]
> Iterate through the hash:
>
> [% FOREACH key = hash.keys %]
> Key: [% key %] Exists: [% hash.exists(key) %] Value: [% hash.$key %]
> Item: [% hash.item(key) %]
> [% END %]
>
> End [% component.name %]
>
>
> With both TT 2.13 and 2.14 the output is:
>
> Start template.tt
> Iterate through the hash:
>
> Key: good Exists: 1 Value: 1234 Item: 1234
>
> Key: bad � Exists: 1 Value: Item: 4321
>
> End template.tt
>
> Note that [% hash.$key %] fails for the UTF-8 key, but [% hash.item(key) %]
> works (and is a workaround).
>
> This is with Perl 5.8.4. Maybe someone can confirm it isn't a Perl problem
> with a more recent version?
>
I guess this is just a problem with the XS stash.
Regards,
Slaven
--
Slaven Rezic > Development
iconmobile GmbH > Methfesselstr. 32-36 > D-10965 Berlin
phone +49 30 890 686 49 > fax +49 30 890 686 50
[EMAIL PROTECTED] > http://www.iconmobile.com
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates