I have implemented a vCard on a website. Problem is though that special characters are not parsed correctly on windows.
I can get it to work fine for Mac, but as soon as I open a vcf in Windows (Windows Contacts) it gets messed up. When I open the vcf in Notepad it shows the characters normally.
I tried all vcf versions I could find (2.1,3.0,4.0). I used charset-utf-8 in my content-type header (text/x-vcard; charset: utf-8). I used N;CHARSET=utf-8: (and for the other tags).
All to no avail.
Does anyone has a solution for this? Thanks for sharing your insight.
Headers used:
header("Content-type: text/x-vcard; charset=utf-8");
header("Content-Disposition: attachment; filename=".$this->filename.".vcf");
header("Pragma: public");
for me to work with UTF-8 and being readable for Mac OS X all polish characters like ĘĄĆŻŹŃŁÓŚ ęąćżźńłóś
was enough to switch to declare VERSION:3.0
To make Outlook import UTF-8 vCards you have to open Outlook options, go to Advanced > International Options and then select UTF-8
for outgoing emails and outgoing vCards... And voila - import works!
Isn't it obvious, that one has to set export options to setup import...? Thanks Microsoft :P
I found that instead of supplying ;CHARSET=utf-8
in the vCard field, I instead supplied ;CHARSET=windows-1252
, which resulted in the vcard opening correctly in Outlook 2010.
Not a solution for everybody, but hope this helps someone.
Use ISO-8859-1 and you should be fine. Just make sure every part in the chain uses that encoding (the .vcf file, the encoding declarations in the .vcf file, and your header).
Header:
Content-Type: text/x-vcard; charset=iso-8859-1
Vcard (example, must be saved with iso-8859-1 encoding):
N;CHARSET=iso-8859-1:Übermann
Tested on Windows, OS X, IOS and Android.
Compared 2 files, one working from a different service and mine. It appeared that the working version from the other service used Content-Type: text/x-vcard; charset=iso-8859-1
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With