XML文件中的UTF-8与UTF8
XML文件中正确的UTF8编码声明是什么?我都看过.
What is the correct UTF8 encoding declaration in XML files? I have seen both.
<?xml version="1.0" encoding="UTF-8"?>
...
或
<?xml version="1.0" encoding="UTF8"?>
...
XML规范( https://www.w3.org/TR/REC-xml/#charencoding ),说:
The XML specification (https://www.w3.org/TR/REC-xml/#charencoding), says:
在编码声明中,应将值"UTF-8","UTF-16","ISO-10646-UCS-2"和"ISO-10646-UCS-4"用于各种编码和Unicode/ISO/IEC 10646的转换...
In an encoding declaration, the values " UTF-8 ", " UTF-16 ", " ISO-10646-UCS-2 ", and " ISO-10646-UCS-4 " should be used for the various encodings and transformations of Unicode / ISO/IEC 10646...
此外,"encoding"的值可以是IANA-CHARSETS中的任何值(
Further, the value of "encoding" can be any value from IANA-CHARSETS (http://www.iana.org/assignments/character-sets/character-sets.xhtml).
UTF-8定义为"UTF-8"或其别名"csUTF8"
UTF-8 is defined as "UTF-8" or its alias "csUTF8"
因此,它应该是"UTF-8"