UTF-8和不带BOM的UTF-8有什么区别? [英] What's the difference between UTF-8 and UTF-8 without BOM?

查看:375
本文介绍了UTF-8和不带BOM的UTF-8有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有 BOM 的UTF-8和UTF-8有什么区别?哪个更好?

What's different between UTF-8 and UTF-8 without a BOM? Which is better?

推荐答案

UTF-8 BOM是文本流(0xEF, 0xBB, 0xBF)开头的一系列 bytes ,允许读者以更可靠地猜测文件是否已以UTF-8编码.

The UTF-8 BOM is a sequence of bytes at the start of a text stream (0xEF, 0xBB, 0xBF) that allows the reader to more reliably guess a file as being encoded in UTF-8.

通常, BOM 用于表示

Normally, the BOM is used to signal the endianness of an encoding, but since endianness is irrelevant to UTF-8, the BOM is unnecessary.

根据 Unicode标准,不建议使用UTF-8文件:

According to the Unicode standard, the BOM for UTF-8 files is not recommended:

2.6编码方案

... UTF-8既不需要也不建议使用BOM,但是在从其他使用BOM的编码形式转换UTF-8数据或BOM用作UTF的情况下可能会遇到BOM. -8签名.请参见 第16.8节特价"中的字节顺序标记"小节 > ,以获取更多信息.

2.6 Encoding Schemes

... Use of a BOM is neither required nor recommended for UTF-8, but may be encountered in contexts where UTF-8 data is converted from other encoding forms that use a BOM or where the BOM is used as a UTF-8 signature. See the "Byte Order Mark" subsection in Section 16.8, Specials, for more information.

这篇关于UTF-8和不带BOM的UTF-8有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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