For the longest time, I’ve used a nifty little export routine that takes any DataTable and pushes it to the browser as a CSV file.  This makes it extremely easy to incorporate an Export to Excel feature into any custom report.

An international client recently requested support for French accent characters.  This was new to me, I didn’t even realize it wasn’t working.   I try to stick with knowing one language at a time Smile

Apparently the necessary encoding is implemented in the web page by default.  That’s why it looks ok in the browser.  But when the CSV is being streamed to the browser for download as a file, the encoding does not default to the same.

The fix was easy enough:

Response.ContentEncoding = System.Text.Encoding.UTF8; 



*POW* Now the CSV has the proper characters for French accent letters.