http://www.perlmonks.org?node_id=1043702


in reply to Re: XML::Parser does not parse the Symbol
in thread XML::Parser does not parse the Symbol

It is working fine if I use ProtocolEncoding

$parser = new XML::Parser(Style => 'Tree'); $xml = $parser->parse($xml, ProtocolEncoding => 'ISO-8859-1')

I have one more clarification, If we use ISO-8859-1, will it support to UTF-8 as well ?

Replies are listed 'Best First'.
Re^3: XML::Parser does not parse the Symbol
by mirod (Canon) on Jul 11, 2013 at 13:35 UTC

    no

    Did you really read the part where I advised you NOT to use ProtocolEncoding?

    If you have to deal with XML, please educate yourself about encodings, it will pay off in the very short term.

      Please correct me if I am wrong.

      You mean that adding the encoding in the xml declaration as follows in xml file:

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

      Is that you are suggestion?

        Yes,if the data is in 8859-1, then it should be marked as such. Otherwise it's not proper XML, it won't parse with any proper parser.

        Make sure it is indeed in ISO-8859-1 though, sometimes it is in windows 1251, which is similar to ISO-8859-1 but not quite (some of the code points are used for different characters, like the smart quotes).