XML文件中的UTF-8与UTF8 [英] UTF-8 vs UTF8 in XML files

查看:248
本文介绍了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"

这篇关于XML文件中的UTF-8与UTF8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆