Solving charset problems importing an external vCard file into Soocial
Hey,
In the interests of Soocial being "hassle-free contacts", I thought I'd share the summary of all the hassle I went through trying to import an existing vCard.
Bottom line is that you not only have to have the file encoded in UTF-8 without BOM, but also that you have to have Unix line breaks (or probably Mac line breaks would work too; Unix was the first one I tried). Windows line breaks definitely do not work.
In my case I had exported the whole address book from my Sony Ericsson w810i to a vCard file on my windows laptop via bluetooth, so that I could clean up some of the contacts before syncing them. There was no indication of what the issue was, or any error message, just outputted "0 contacts imported" or something along those lines and wiped my contact list anyway.
Anyone on a windows machine and having this problem, I recommend downloading Notepad++, which is free open source software. Open up your file, and hit the Format menu. Click "Convert to UTF-8 format without BOM", and on the same menu set it to Encode to UTF-8 format without BOM. The kicker is to click Convert To UNIX Format on that menu as well to fix your line breaks.
Hope this helps someone else!
In the interests of Soocial being "hassle-free contacts", I thought I'd share the summary of all the hassle I went through trying to import an existing vCard.
Bottom line is that you not only have to have the file encoded in UTF-8 without BOM, but also that you have to have Unix line breaks (or probably Mac line breaks would work too; Unix was the first one I tried). Windows line breaks definitely do not work.
In my case I had exported the whole address book from my Sony Ericsson w810i to a vCard file on my windows laptop via bluetooth, so that I could clean up some of the contacts before syncing them. There was no indication of what the issue was, or any error message, just outputted "0 contacts imported" or something along those lines and wiped my contact list anyway.
Anyone on a windows machine and having this problem, I recommend downloading Notepad++, which is free open source software. Open up your file, and hit the Format menu. Click "Convert to UTF-8 format without BOM", and on the same menu set it to Encode to UTF-8 format without BOM. The kicker is to click Convert To UNIX Format on that menu as well to fix your line breaks.
Hope this helps someone else!
1
person likes this idea
I like this idea!
Tell me when this idea gets some attention.
The more people who like this idea, the more it gets noticed.
The more people who like this idea, the more it gets noticed.
The company implemented this idea.
-
Inappropriate?Hey Grank,
Sorry for the hassle. Shows you how hard it is to get the syncing right, with all the differences between the devices.
I'd really want to take a look at your logs to see what happened on the W810i sync. Did you say your contacts got deleted from the phone? That would be nasty.
Can you sen your user name to support (at soocial dot com)? -
Inappropriate?Oh no worries, it didn't delete contacts from the phone, I didn't even have it set up to sync yet. I was just trying to import the vCard file, and what I was referring to was that it wouldn't parse the vCard file correctly (my guess is that it was hitting the first CR character and either treating it as eof or aborting) and would import 0 contacts from it but even when it gets nothing from the import it still wipes all the existing soocial contacts. (I didn't have any yet as I'm a new user, so again I didn't lose anything myself, but I can imagine how frustrating that would be for people!)
I understand that this is just a restore-from-backup feature at this point and isn't meant to add new contacts alongside existing ones, but it might be good to check if it got at least one contact out of the file before wiping the existing soocial contacts, as something probably went wrong with the import if it didn't find ANY.
Anyway, I know how difficult it is to determine the line breaking format in a text file, because they're so inconsistent:
DOS / Windows: CR LF
UNIX / OSX: LF
Mac (pre-OSX): CR
So if you want to replace both CR LF, and CR by itself, with a single LF before parsing the input, you could use regular expressions, or do two loops...
Anyway, before I got it to work I was experimenting with a couple different possibilities, character sets, vCard 2.1 vs 3.0, all of that, so my logs would be pretty messy, and I've done a successful full import twice now so depending on how long/large you keep logs, the troubles may not even still be around. Do you still want me to send my username?
I’m curious
-
So if I get it right, you were trying to import contacts to Soocial from a VCF. I can see how that could go wrong. Since it states it overwrites existing contacts clearly I don't think it is a big problem. -
Inappropriate?Well, it's only a big problem if it fails and someone loses all their contacts. It's conceivable that someone could take a backup, edit it in some way, and not be able to re-import it and then have no contacts...
I guess there are two separate things here:
1) BUG: vCard import fails if the VCF file contains CR characters (which it quite often will if it comes from a Windows platform or a device designed primarily to interface with a Windows platform, which is most consumer devices since Windows still has the biggest general user market share)
2) SUGGESTION: Don't wipe the existing contacts if the vCard import imports 0 contacts, because that seems really silly. Parse the VCF for the new contacts before deleting all the existing contacts, and then fail the import and abort if there isn't at least 1 contact parsed.
I understand dismissing #2 if that's your wont, but I would urge you not to do so with #1. :)
I’m surprised
Loading Profile...




EMPLOYEE