Friday, March 28, 2008

Leopard AddressBook: new encoding for vCard

I have an application which can export "My Card" in addressbook to a vCard (.vcf) file and then import it to another application. For Leopard, this approach stopped working.

The applescript for exporting looks like:
After digging some details, I realized that the reason is that in Leopard, the output file is no longer a UTF-8 encoding file. It's UTF-16BE! So the file looks like:


Dump it in hex mode, found the magic is the first word:
FE FF

OK, now ignore in the importing application and everything is fine.