C# ASP.NET响应-UTF-16编码文件,但浏览器中未显示任何内容

C# ASP.NET响应-UTF-16编码文件,但浏览器中未显示任何内容,c#,asp.net,encoding,utf-8,utf-16,C#,Asp.net,Encoding,Utf 8,Utf 16,我正在尝试从ASP.NET应用程序以HTTP响应的形式发送UTF-16BE文本文件 Response.ContentType = "text/plain"; Response.ContentEncoding = System.Text.UnicodeEncoding.BigEndianUnicode; Response.WriteFile(filename); 但是没有显示任何结果,Fiddler也没有显示任何编码 是我还是网络浏览器不喜欢utf-16文本?不,你的网络浏览器不是问题所在 此

我正在尝试从ASP.NET应用程序以HTTP响应的形式发送UTF-16BE文本文件

Response.ContentType = "text/plain";
Response.ContentEncoding = System.Text.UnicodeEncoding.BigEndianUnicode;
Response.WriteFile(filename);
但是没有显示任何结果,Fiddler也没有显示任何编码


是我还是网络浏览器不喜欢utf-16文本?

不,你的网络浏览器不是问题所在

此代码:

context.Response.ContentType = "text/html";
context.Response.ContentEncoding = UnicodeEncoding.BigEndianUnicode;
context.Response.Write("Hello World");
生成预期的内容编码:

但只要使用
context.Response.WriteFile
,内容编码就会被删除。不确定这是否是一项功能。我假设另一端的软件必须根据返回的输出确定内容编码