UTF-8 vs UTF8 in XML files

吃可爱长大的小学妹 提交于 2019-12-10 22:24:10

问题


What is the correct UTF8 encoding declaration in XML files? I have seen both.

<?xml version="1.0" encoding="UTF-8"?>
...

or

<?xml version="1.0" encoding="UTF8"?>
...

回答1:


The XML specification (https://www.w3.org/TR/REC-xml/#charencoding), says:

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...

Further, the value of "encoding" can be any value from IANA-CHARSETS (http://www.iana.org/assignments/character-sets/character-sets.xhtml).

UTF-8 is defined as "UTF-8" or its alias "csUTF8"

Therefore, it should be "UTF-8"



来源:https://stackoverflow.com/questions/36094939/utf-8-vs-utf8-in-xml-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!