Debugging ASP.NET Strings Downloaded to Browser (Montréal instead of Montréal)

Posted by jdk on Stack Overflow See other posts from Stack Overflow or by jdk
Published on 2010-03-28T03:25:30Z Indexed on 2010/03/28 4:03 UTC
Read the original article Hit count: 602

Filed under:
|
|
|
|

I'm downloading a vCard to the browser using Response.Write to output .NET strings with special accented characters. Mime type is text/x-vcard and French characters are appearing wrong in Outlook, for example Montréal;Québec .NET string shows as Montréal Québec in browser.

I'm using this vCard generator code from CodeProject.com

I've played with the System.Encoding sample code at the bottom of this linked MSDN page to convert the unicode string into bytes and then write the ascii bytes but then I get Montr?al Qu?bec (progress but not a win). Also I've tried setting content type to both us-ascii and utf-8 of the response.

If I open the downloaded vCard in Windows Notepad and save it as ANSI text (instead of default unicode format) and open in Outlook it's okay. So my assumption is I need to cause download of ANSI charset but am unsure if I'm doing it wrong or have a misunderstanding of where to start.

Update: Looking at the raw HTTP, it appears my French characters are being downloaded in the unexpected format so it looks like I need to do some work on the server side... raw (full size)

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about http