Z-push is open-source software that supports the Exchange Active Sync protocol. It can send email from IMAP, VCards and the like to a phone over that protocol.
I wanted to use its VCardDir feature, but it couldn't read Chinese correctly in VCard files generated by either Windows or Android… All I got was garbled text.
To solve this, I had to spend a day and a half learning PHP from scratch… After going through backend/vcardir.php line by line, I found that the problem was in the w2ui function…
To accommodate European countries that use nonstandard Latin characters, w2ui converts nonstandard Windows characters to Unicode. Chinese, however, isn't covered by that encoding, so the conversion goes haywire…
Since my VCards are already in Unicode, I only need to remove this step.
A convenient fix is to find the definition of w2ui (and the other similar functions)—it's elsewhere, so use a search tool—and change its return statement to return the input argument directly. That takes care of it once and for all.
However, when I add a new entry on my phone, it still can't automatically name the VCard file. I'll leave that one for someone more knowledgeable to solve…