问题
Is "EF BF BF" an allowed character in XML (UTF-8)?
<?xml version="1.0" encoding="UTF-8" ?>
<XML>
<DOCUMENT>
<CONTENT>" "</CONTENT>
</DOCUMENT>
</XML>
回答1:
If "EF BF BF" is a typo, and you meant "EF BB BF":
Yes, if it is the first bytes. They are the "BOM", Byte Order Mark, used to identify the endianness of the file.
For UTF-16 and UTF-32-encoded files this is mandatory.
For UTF-8, this is optional. Some systems might be confused by it if it is present, and it might give unexpected behavior if an UTF-8-file with BOM is used in a context expecting for example ISO-8859-1.
Edit: If "EF BF BF" isn't a typo, it is not valid UTF-8 anywhere in the file.
来源:https://stackoverflow.com/questions/10310210/is-ef-bf-bf-an-allowed-character-in-xml-utf-8