How default is the default encoding (UTF-8) in the XML Declaration?

后端 未结 4 429
执念已碎
执念已碎 2020-12-07 01:33

I know that the default encoding of XML is UTF-8. All XML consumers MUST and so on and so forth. So this is not just a question whether or not XML has a default encoding.

4条回答
  •  生来不讨喜
    2020-12-07 02:08

    It would not be unreasonable for the second declaration to be rejected if it arrived at the start of a document that had already been detected as having a non-UTF-8 compatible encoding (such as UTF-16). However, given your statement that the document is UTF-8 encoded, there is no difference between how they would be treated.

    An externally-specified encoding would take precedence in both cases; both documents would still be treated identically.

提交回复
热议问题