Reputation: 148664
I have this C# code which downloads a file from server :
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();
}
Notice that filename has a fixed value ( for testing).
When I click a button :
I DO see in FIDDLER the right name :
And Chrome does shows the right filename to save :
But Internet explorer shows gibberish :
Additional Information :
IE 11 , windows 7 64bit , Edge :
Page encoding :
Question:
Why does the filename shown as gibberish and how can I fix it ?
Upvotes: 1
Views: 816
Reputation: 42045
Because you can't use non-ASCII characters inside Content-Disposition without additional escaping. See http://greenbytes.de/tech/webdav/rfc6266.html#disposition.parameter.filename.
Upvotes: 1