Re: [xml-dev] [Summary] Why is Encoding Metadata (e.g. encoding="UTF-8") put Inside the XML Document?

From
Philippe Poulard <>
To
David Carlisle <>
Date
2007-09-20T13:34:22Z
ID
<>
Thread
Re: [xml-dev] [Summary] Why is Encoding Metadata (e.g. encoding="UTF-8") put Inside the XML Document?
David Carlisle a écrit :
> There, if there is no external metadata or xml declaration the file has
> to be in utf16 or utf8, and the BOM is optional for utf8, so if the file
> has no BOM, then the parser does not "give up" The file is treated as if
> utf8 is specified.

The BOM has some sense only with 16-bits encoding charsets ; it 
indicates the endianness, that is to say which one of the 2 bytes is 
stored first

If the encoding it specified as UTF-16 without more indications about 
endianness, or not specified at all, the BOM -if present- will state if 
it is UTF-16le or UTF-16be (it seems that if the encoding is specified, 
it is a redundant information)

If the BOM is missing and the encoding not specified, the encoding is 
either UTF-16xx (I don't remember which one is the default :) ) or UTF-8

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !