是"EF BF BF"吗? XML(UTF-8)中允许的字符? [英] Is "EF BF BF" an allowed character in XML (UTF-8)?

查看:152
本文介绍了是"EF BF BF"吗? XML(UTF-8)中允许的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"EF BF BF"是XML(UTF-8)允许的字符吗?

Is "EF BF BF" an allowed character in XML (UTF-8)?

<?xml version="1.0" encoding="UTF-8" ?>
<XML>
    <DOCUMENT>
        <CONTENT>" "</CONTENT>
    </DOCUMENT>
</XML>

推荐答案

如果"EF BF BF"是拼写错误,而您的意思是"EF BB BF":

If "EF BF BF" is a typo, and you meant "EF BB BF":

是的,如果它是第一个字节.它们是"BOM",字节顺序标记,用于标识字节序.

Yes, if it is the first bytes. They are the "BOM", Byte Order Mark, used to identify the endianness of the file.

对于UTF-16和UTF-32编码的文件,这是强制性的.

对于UTF-8,这是可选的.如果存在,某些系统可能会对它感到困惑,并且如果在期望使用ISO-8859-1的上下文中使用带有BOM的UTF-8文件,则可能会产生意外的行为.

For UTF-8, this is optional. Some systems might be confused by it if it is present, and it might give unexpected behavior if an UTF-8-file with BOM is used in a context expecting for example ISO-8859-1.

修改: 如果"EF BF BF"不是拼写错误,则它是无效的UTF -8 在文件中的任何位置.

Edit: If "EF BF BF" isn't a typo, it is not valid UTF-8 anywhere in the file.

这篇关于是"EF BF BF"吗? XML(UTF-8)中允许的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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