国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

C#創(chuàng)建UTF8無BOM文本文件

2019-11-17 03:14:03
字體:
來源:轉載
供稿:網友

C#創(chuàng)建UTF8無BOM文本文件

In order to omit the byte order mark (BOM), your stream must use a custom instance of UTF8Encoding instead of the default System.Text.Encoding.UTF8:

1.Call the UTF8Encoding constructor with False for the encoderShouldEmitUTF8Identifier parameter.

2.Pass the UTF8Encoding instance to the stream constructor.

實例:

var utf8WithoutBom = new System.Text.UTF8Encoding(false);                                                //^^^^^using (var sink = new StreamWriter("Foobar.txt", false, utf8WithoutBom)){    sink.WriteLine("...");}

Note that omitting the BOM is only permissible for UTF-8, not for UTF-16.


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 农安县| 玛多县| 林口县| 伽师县| 洛隆县| 诸暨市| 宜宾县| 通河县| 息烽县| 夹江县| 灵台县| 太仓市| 孙吴县| 朝阳市| 阿鲁科尔沁旗| 古交市| 图们市| 明光市| 张家口市| 赣州市| 阿鲁科尔沁旗| 中宁县| 新津县| 镇赉县| 天等县| 偏关县| 渑池县| 财经| 桃源县| 繁峙县| 平阳县| 南丹县| 固安县| 石柱| 延吉市| 邢台县| 哈巴河县| 昭通市| 织金县| 营口市| 花莲县|