views:

26

answers:

0

I have encountered an issue when trying to serve files with spanish tildes, related to the Content-Disposition encoding.

The file name is "qué hacés ahora.docx"

So far, the ASP.NET MVC way of serving files adds this header, which works fine only in Firefox:

Content-Disposition: attachment; filename*=UTF-8''qu%C3%A9%20hac%C3%A9s%20ahora.docx

I am using in the controller:

return File(path, "application/octet-stream", originalNameWithAccents);

This is not working in IE or Chrome.

So, I went and emailed myself the file as an attachment using GMail. Using firebug to see what is going on, the Content-Disposition google is sending back down is:

Content-Disposition: attachment; filename="=?UTF-8?B?cXXDqSBoYWPDqXMgYWhvcmEuZG9jeA==?="

Notice how the name is base64 encoded (cXXDqSBoYWPDqXMgYWhvcmEuZG9jeA==).

So, I have 2 questions so far:

  1. Where is an specification for this?
  2. Are there any known ways of serving this type filename using ASP.NET?

related questions