0

My application uploads unicode file from client to server and storing in the database is done correctly. Encoding is kept. The file name is also well displayed in the page including the diacritics. My problem is with downloading the file - the file name is broken, however, file content is ok.

--- Sending from server to client ---

string fileName = ... 
byte[] bytes = ... 

Page.Response.Clear(); 
Page.Response.AddHeader("content-disposition", "attachment;filename=" + fileName); 
Page.Response.OutputStream.Write(bytes, 0, bytes.Length); 
Page.Response.End();

Can you please advise where the problem can be?

JosefZ
  • 28,460
  • 5
  • 44
  • 83
kalous
  • 7
  • 2
  • Please [edit] the question and add a [mcve] including some example(s) of real and garbled file name(s). – JosefZ Aug 06 '17 at 19:15
  • You can't put non-ASCII characters in a Content-Disposition filename, without a lot of faff. Background https://stackoverflow.com/questions/1361604 – bobince Aug 07 '17 at 17:52
  • Original file name displayed in the browser: Čěština ú ů öäüß.docx, Filename after download by IE, Chrome: Čěština+ú++ů+öäüß.docx, Filename after download by Firefox: %c4%8c%c4%9b%c5%a1tina+%c3%ba++%c5%af+%c3%b6%c3%a4%c3%bc%c3%9f.docx – kalous Aug 12 '17 at 18:37

0 Answers0