Lists Home |
Date Index |
Gustaf Liljegren wrote:
> Consider this document, encoded in UTF-8 with no BOM:
> <?xml version="1.0"?>
> Is there a safe way for a non-XML-aware text editor to find out that this
> file is using UTF-8?
It is not ambiguous at all what the encoding must be; there's no
encoding declaration, so it must be UTF-8. The parser, in order to
parse, clearly knows this. For this reason, the encoding is in the
infoset, since the parser can't not know it. Whether or not the softare
you're using exposes this knowledge is another matter.
> There are still a lot of people over here who likes to use ISO 8859-1,
> because they have the conception that 'ä' is written 'Ã¤' in UTF-8.
The file xml.xml, the original XML 1.0 specification, was encoded in
8859-1, there's nothing wrong with that, it's a perfectly decent
encoding if you're working in a European-language context, and in
practical terms all widely-used XML software supports it just fine. -Tim