[英]As soon pdf file is open in Internet Explorer, the printmask should be open
[英]Internet explorer shows gibberish for save/open file?
我有此C#代码,可从服务器下载文件:
public static void DownloadBinaryFile(byte[] _ByteArray, string fullfileName)
{
fullfileName = "רועי.pdf"; //"Royi.pdf" in hebrew
System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + fullfileName);
System.Web.HttpContext.Current.Response.BinaryWrite(_ByteArray);
System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream";
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.End();
}
请注意,文件名具有固定值(用于测试)。
当我点击一个按钮时:
我确实在FIDDLER中看到正确的名称:
Chrome 确实显示了要保存的正确文件名:
但是Internet Explorer显示乱码:
附加信息 :
IE 11,Windows 7 64位,Edge:
页面编码:
题:
为什么文件名显示为乱码,我该如何解决?
因为您不能在没有附加转义的情况下在Content-Disposition中使用非ASCII字符。 请参阅http://greenbytes.de/tech/webdav/rfc6266.html#disposition.parameter.filename 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.