C#使用StreamWriter生成UTF-八无BOM编码格式

C#使用StreamWriter生成UTF-8无BOM编码格式使用UTF-8式产生的文件,用二进制查看会多出“\xef\xbb\xbf”几个

C#使用StreamWriter生成UTF-8无BOM编码格式

使用UTF-8格式产生的文件,用二进制查看会多出“\xef\xbb\xbf”几个字节

使用UTF-8无BOM格式:

UTF8Encodingutf8 = new UTF8Encoding(false);StreamWriter  sw = new StreamWriter (strPath,false,utf8);sw.WriteLine(strHtml);