XML 个文件中的 UTF-8 与 UTF8

UTF-8 vs UTF8 in XML files

XML 文件中正确的 UTF8 编码声明是什么?我都看过了。

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

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

XML 规范 (https://www.w3.org/TR/REC-xml/#charencoding),说:

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 (http://www.iana.org/assignments/character-sets/character-sets.xhtml) 的任何值。

UTF-8 定义为 "UTF-8" 或其别名 "csUTF8"

所以应该是"UTF-8"