FileContentResult and international characters

Posted by suzi167 on Stack Overflow See other posts from Stack Overflow or by suzi167
Published on 2009-07-16T18:13:34Z Indexed on 2010/05/25 7:51 UTC
Read the original article Hit count: 271

Filed under:

Hello,

I am using a fileContentResult to render a file to the browser. It works well except that it throws an exception when the fileName contains international characters. I remember reading somewhere that this feature does not support international characters but I am sure there mustbe a workaround or a best practice people follow in cases the application needs to upload files in countries other than US.

Does anyone know of such a practice?Here is the ActionResult Method

public ActionResult GetFile(byte[] value, string fileName)
    {
        string fileExtension = Path.GetExtension(fileName);
        string contentType = GetContentType(fileExtension); //gets the content Type
        return File(value, contentType, fileName);
    }

THanks in advance

Susan

© Stack Overflow or respective owner

Related posts about asp.net-mvc