I am writing a method that allows a user to generate a vCard file based on some information. It works quite well and the user can open the generated file with Microsoft Outlook without any problem (tested on versions 2010 and 2013). But when he wants to open it with Windows Contacts, the accented characters are not well displayed whereas I have set the charset to the different fields to UTF-8.
Here is an example of a generated vCard:
BEGIN:VCARD
VERSION:4.0
FN;CHARSET=utf-8:Vandenbergh Cédric
N;CHARSET=utf-8:Vandenbergh;Cédric;;;
TITLE;CHARSET=utf-8:Manager d'entité
END:VCARD
And here is what I get when opening it with Windows Contacts:
Could it be a bug in Windows Contacts (tested under Windows 8.1)? Or am I missing something?
Edit
Here is the code I use for a user to download a vCard:
Context.Response.Clear();
Context.Response.Buffer = true;
Context.Response.ContentType = "text/x-vCard; charset=utf-8";
Context.Response.AddHeader("Content-Disposition", "attachment;filename=file.vcf");
Context.Response.Write(user.GetVCard()); // Get vCard content
Context.Response.Flush();
Context.Response.End();
Edit 2/10/15
I still have no idea on how to solve this problem. In my opinion, it could really be a Windows Contacts bug but I cannot find anything on the web to confirm my impression.
Just because you add a "CHARSET=utf-8" parameter doesn't mean the value will be written in UTF-8. You are probably not setting the character encoding to "UTF-8" when you write the vCard.
Also, note that vCard version 4.0 does not support the "CHARSET" parameter. The specification states that all vCards MUST be written in UTF-8.