【发布时间】:2010-09-30 01:40:30
【问题描述】:
sn-p 说明了一切 :-)
UTF8Encoding enc = new UTF8Encoding(true/*include Byte Order Mark*/);
byte[] data = enc.GetBytes("a");
// data has length 1.
// I expected the BOM to be included. What's up?
【问题讨论】:
-
如下所述,UTF8 不需要 BOM。
-
说“UTF-8 不需要 BOM”是完全不准确的。序言是应用程序如何区分 UTF8 和编码分页的 ANSI。
标签: c# .net unicode encoding utf-8