XML文件编码格式“utf-8” VS“UTF-8”?

发布于 2024-09-09 18:02:25 字数 277 浏览 2 评论 0原文

当 XML 文件转换为 ASCII 时。 utfUTF这三个字符对于用户来说是不同的值。

<?xml version="1.0" encoding="utf-8"?>


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

我尝试用vs2005创建一个新的xml文件。默认生成utf-8表单文件。

哪一个是更标准的定义?谢谢。

When the XML file was convert to ASCII. It is different values for user at the three characters of utf and UTF.

<?xml version="1.0" encoding="utf-8"?>


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

I tried to create a new xml file with vs2005. utf-8 form file generated by default.

which one is a more standard definition? thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

浮光之海 2024-09-16 18:02:25

IANA 字符集注册表表示

使用之间没有区别
大写和小写字母。

但是该页面、XML 规范unicode.org 对于大写 UTF-8 是一致的。

The IANA character set registry says:

no distinction is made between use of
upper and lower case letters.

But that page, the XML specification, and unicode.org are consistent about capitalizing UTF-8.

梦开始←不甜 2024-09-16 18:02:25

来自 XML 规范

“XML 处理器应该匹配不区分大小写的字符编码名称way”

这表示您可以根据需要使用大写或小写,甚至混合大小写。但是,该规范在所有示例中都使用“UTF-8”,因此为了保持一致性,我会使用“UTF-8”。

From the XML specification:

"XML processors SHOULD match character encoding names in a case-insensitive way"

This indicates that you can use upper case or lower case or even mixed case if you wish. However, the specification uses "UTF-8" in all its examples so for consistency I'd go with that.

黯淡〆 2024-09-16 18:02:25

对于那些对血淋淋的细节感兴趣的人 - 包括一些相关标准和先例的链接 - 几年前我在博客上写了关于 XML 声明中 UTF-8 的区分大小写

For those interested in the gory details - including links to some of the related standards and precedents - I blogged a couple of years ago about Case-Sensitivity of UTF-8 in XML Declarations.

噩梦成真你也成魔 2024-09-16 18:02:25

根据我的经验(主要是 .NET),字符集标识符被视为不区分大小写,因此 UTF-8utf-8 以及 UTF-8 或其任何其他变体,始终表示相同的意思。对于其他字符集,例如 ISO-8859-1 (Latin 1) 等,情况也是如此。大小写应该无关紧要,因为大小写在此类标识符中不是一个有意义的因素。

我对跨多个平台的 Web 服务进行了大量工作,但我从未真正见过使用的“标准”形式。我见过各种字符集的各种变体……通常是来自单个业务合作伙伴的不同变体。

In my experience (which is primarily with .NET), character set identifiers are treated as case-insensitive, so UTF-8 and utf-8, as well as Utf-8 or any other variation thereof, always mean the same thing. This would also be the case for other character sets, such as ISO-8859-1 (Latin 1), etc. The casing should not matter, as case is not a meaninful factor in such an identifier.

I do extensive work with web services across multiple platforms, and I have never really seen a "standard" form used. I've seen every variation of a variety of character sets...often different variations from a single business partner.

零崎曲识 2024-09-16 18:02:25

大写是事实上的标准。但是,它仍然适用于任意大小写组合。

Upper-case is the de-facto standard. It should still work with any combination of case, however.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文