How to serve vCards with the right encoding

It seems that some programs which recognize vCards only support the ISO-8859-1 character set. So if you’re serving vCards on your web site, you might want to check if the encoding is correct. Try inserting a non-ASCII character like “å” in a note or address, and see if it comes out as a strange character when loading it from the web site.

To fix this, first make sure that your editor uses the correct encoding. Open the file, change the encoding, save the file, re-open it and correct the contents if the characters were messed up after saving (not all editors change characters correctly).

You might also have to override the server’s default encoding. If you’re using Apache 2, just add the following to the .htaccess file at the root of the web site:
AddCharset ISO-8859-1 .vcf
AddEncoding text/x-vcard .vcf

Turns out that didn’t work so well (I didn’t find out until i did a shift-reload). I had to turn to this one instead:
<Files *.vcf>
ForceType 'text/x-vcard; charset=ISO-8859-1'


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s