0

I have a controller

    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult ExportToWord(string docId)
    {
        .... create document in the stream ...
        return File(stream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "test-ø-æ-å.docx");
    }

Firefox, Chrome and IE9 return correct filen name «test-ø-æ-å.docx»

IE7, IE8 return «ExportToWord.docx»

If file name does not include norwegian letters så it works correct for IE7-8 also.

How to fix this problem? Thanks!

My solution:

if (Request.Browser.Browser == "IE" && (Request.Browser.Version == "7.0" || Request.Browser.Version == "8.0"))
{
            fileName = Uri.EscapeDataString(fileName).Replace("%20", " ");
            or
            fileName = Uri.EscapeDataString(fileName.Replace(" ", "_"));
}
tereško
  • 58,060
  • 25
  • 98
  • 150
podeig
  • 2,597
  • 8
  • 36
  • 60
  • 2
    possible duplicate of [How to encode the filename parameter of Content-Disposition header in HTTP?](http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition-header-in-http) – Adriano Repetti May 23 '12 at 12:09
  • It was not precisely the same, but I picked some ideas from there. Thank you! :) – podeig May 23 '12 at 12:56

0 Answers0