Problems with special characters (I suppose it is 'locales')

F

Francesco Moi

Hello.

I'm using 'XML::parser' and when parsing an XML file with special
characters (Spanish), I get some problems with them:
'á' is converted to 'á' (for example)

I don't know if I must change 'locales' on the System (Linux
RedHat). And I do not know how to change it.

I would be extremely obliged if anybody had any experience.
 
M

Michel Rodriguez

Francesco said:
I'm using 'XML::parser' and when parsing an XML file with special
characters (Spanish), I get some problems with them:
'á' is converted to 'á' (for example)

I don't know if I must change 'locales' on the System (Linux
RedHat). And I do not know how to change it.

I would be extremely obliged if anybody had any experience.

XML::parser, like most other XML parsers, converts all strings to UTF-8,
you need to convert them back to latin-1 (I suppose), using Encode or
Text::Iconv or Unicode::*

See the Perl-XML FAQ: http://perl-xml.sourceforge.net/faq/#encodings

This is part of the documentation of the module BTW:

Handlers
...
Char (Expat, String)

This event is generated when non-markup is recognized. The
non-markup sequence of characters is in String. A single
non-markup sequence of characters may generate multiple calls to
this handler. Whatever the encoding of the string in the original
document, this is given to the handler in UTF-8.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top