in reply to How to check the encoding format of an XML

I don't think that you need to know about the XML's encoding. Normally the XML document should be passed as octets and it's the XML parser's duty to detect the document encoding and convert the contents to perl characters.

If you really want to know the encoding, then you can use the encoding() method in XML::LibXML::Document. Maybe XML::Parser has a similar property.

  • Comment on Re: How to check the encoding format of an XML

Replies are listed 'Best First'.
Re^2: How to check the encoding format of an XML
by eserte (Deacon) on Nov 20, 2007 at 21:12 UTC
    Disregard my last answer. I missed the word "without".

    Adding to the Encode::Guess recommendation, you can try this yet unfinished script for guessing encodings. The approach here is different: you specify the set of characters you expect as unicode codepoints (the script uses ASCII + special German characters) and optionally a set of encodings to guess from. The output is a list of possibly matching encodings with the probability.