Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

unicode - UTF-8和不带BOM的UTF-8有什么区别?(What's the difference between UTF-8 and UTF-8 without BOM?)

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

(没有BOM的 UTF-8和UTF-8有什么区别?)

Which is better?

(哪个更好?)

  ask by simple translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The UTF-8 BOM is a sequence of Bytes at the start of a text-stream (EF BB BF) that allows the reader to more reliably guess a file as being encoded in UTF-8.

(UTF-8 BOM是文本流(EF BB BF)开头的字节序列,它使读者可以更可靠地猜测文件是否已以UTF-8编码。)

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

(通常,BOM用来表示编码的字节序,但是由于字节序与UTF-8不相关,因此不需要BOM。)

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

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

2.6 Encoding Schemes (2.6编码方案)

... 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.

(...对于UTF-8既不需要也不建议使用BOM,但是在从使用BOM的其他编码形式转换UTF-8数据或BOM用作UTF-8签名的情况下可能会遇到BOM。 。)

See the “Byte Order Mark” subsection in Section 16.8, Specials , for more information.

(有关更多信息请参见第16.8节特价 ”中的“字节顺序标记”小节。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...