John A Grandy wrote:
How to determine the encoding type for an existing .xml doc ? UTF8 , 1252 ,
etc.
If the encoding is anything but UTF-8 or UTF-16 then the XML document
should have an XML declaration at the beginning declaring the encoding e.g.
<?xml version="1.0" encoding="Windows-1252"?>
Of course it is allowed to use the XML declaration for UTF-8 or UTF-16
too but if it is not there the XML parser is supposed to detect it using
the presence/absence of a fitting BOM, see
<http://www.w3.org/TR/REC-xml/#charencodingfor details.
Whether it is XML or HTML or some other text it is in general not
possible to determine the encoding of a document without there being
some declaration (e.g. XML declaration in XML, <metaelement in HTML)
or external information (e.g. HTTP Content-Type header with charset
parameter) that describes the encoding.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/