Hi,

I am trying to create a HTML page (using TT). The data may include
exotic characters. My efforts to output the characters correctly seem
to be hitting a problem. So I wrote a (kinda) test to help me narrow
down the problem but I'm still not getting the correct result. I can
only hope that the characters make it to the list correctly.

In the script below, the key on the hash is the string literal, the
value is what I would expect the return from encoded_entities to look
like. Instead I seem to get a lot of &Atilde returned. I have checked
my version of HTML::Entities and the entities are in the file so I
must be doing something wrong but I can't see what. Can anyone offer
any advise?

Thanks in advance,
Dermot.



use strict;
use warnings;

use HTML::Entities;
use Encode::Encoder qw(encoder);

my %tests = (
    'Barré'         => 'Barré',             # also tried é
    'Mickaël'       => 'Michaël',           # small e, umlaut mark
    'frédéric'      => 'fréd´ric',
    'Benoît'        => 'Beniît',
    'Jérôme'        => 'Jérôme',
);


for (keys %tests) {
    print encoder($_)->iso_8859_1."\n";
    print "$_: " . encode_entities($_) ." == $tests{$_}  or " .
decode_entities($tests{$_}) ."\n";
}


======== Output ============

Jérôme
Jérôme: Jérôme == Jérôme  or J�r�me
Mickaël
Mickaël: Mickaël == Michaël  or Micha�l
Benoît
Benoît: Benoît == Beniît  or Beni�t
Barré
Barré: Barré == Barré  or Barr
frédéric
frédéric: frédéric == fréd´ric
or fr�d�ric

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to