in reply to Need help in parsing the special characters using XML::Parser

I did not look at the code, but most likely, the problem comes from the data. It is most likely in ISO-8859-2 (aka Latin 2).

If no encoding is specified, XML::Parser expects the data to be in UTF8. The proper way to do this is to include this information in the document itself, by starting it with the XML Declaration:

<?xml version="1.0" encoding="ISO-8859-2"?>

You could also pre-process the XML, using iconv for example to convert it to UTF-8. An other way, only if there is really no way for you to change the XML, would be to use the ProtocolEncoding option in XML::Parser.

Bear in mind that all the data that your handlers will receive from the parser will be UTF-8, so if you want to get it back in Latin 2 you will have to convert it back, using Encode, or iconv for example.

Replies are listed 'Best First'.
Re^2: Need help in parsing the special characters using XML::Parser
by Anonymous Monk on Oct 29, 2008 at 00:51 UTC
    Great resource, thanks for providing it!