我正在向TextWriter
. 我希望 UTF-16 字节顺序标记 ( BOM
) 出现在输出中:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentEncoding = new UnicodeEncoding(true, true);
WriteStuffToTextWriter(context.Response.Output);
}
除了输出不包含字节顺序标记:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Thu, 06 Sep 2012 21:09:23 GMT
X-AspNet-Version: 4.0.30319
Content-Disposition: attachment; filename="Transactions_Calendar_20120906.csv"
Cache-Control: private
Content-Type: text/csv; filename="Transactions_Calendar_20120906.csv"; charset=utf-16BE
Content-Length: 95022
Connection: Close
JobName,ShiftName,6////09////2012 12::::00::::00 АΜ,...
我如何告诉 aTextWriter
编写编码标记?
context.Response.ContentEncoding = new UnicodeEncoding(true, true);
byteOrderMark
类型:true指定提供 Unicode 字节顺序标记;否则,false。System.Boolean