I have an action in aspnet mvc that returns a FileContentResult. I have noticed that when the fileDownloadName contains umlauts (ie ???ü) Internet Explorer can't read the file name at all.
I have tried UrlEncoding:
return this.File(document.Content, contentType, Server.UrlEncode(document.Name));
but then all spaces are replaced by plus signs (+).
Is there a way to get unicode file names work with IE (keeping the original file name intact)?
This is what I'm currently using as a hack:
return this.File(
document.Content,
contentType,
Server.UrlEncode(document.Name).Replace('+',' '));
(This renders space as an underscore in IE)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…