Fixing Mangled Contact Labels on iPhone

Image representing iPhone as depicted in Crunc...
Image via CrunchBase

A coworker sent this along.  I’ve had this issue on a few contacts and didn’t really have time to delve into it.

Name removed to protect the innocent and good intentions.  Be very careful with this and make sure you have a backup of all data that you plan to manipulate.

FWIW …

After serially using every calendar/address book interface under the sun and transitioning to Snow Leopard with Exchange syncing, I ended up with a bunch of munged Address Book extension labels in my iPhone Contacts like:

item1.X-ABLabel:_$!<EX-AssistantPhone>!$_

The extra long labels forces the text to be tiny, and rarely displays even then to say whether this is the work/home number.

If you encounter this problem and you’re a Mac user with a Unix background, I’m sure you can think of a dozen ways to fix this … else see some rudimentary Address Book/iTunes/command line steps below to handle large numbers of Contacts at once.

Caveat emptor.

The munged contacts had labels like:

item1.X-ABLabel:_$!<EX-AssistantPhone>!$_
item1.X-ABLabel:_$!<EX-BusinessFax>!$_
item1.X-ABLabel:_$!<EX-BusinessHomePage>!$_
item1.X-ABLabel:_$!<EX-BusinessPhone>!$_
item1.X-ABLabel:_$!<EX-EmailAddress1>!$_
item1.X-ABLabel:_$!<EX-Home>!$_
item1.X-ABLabel:_$!<EX-HomePhone>!$_
item1.X-ABLabel:_$!<EX-MobilePhone>!$_
item1.X-ABLabel:_$!<Other>!$_

… the bracketing parts are the problem. I can live with “HomePhone” versus “Home Phone”. YMMV.

Correcting this involves a few steps and a tiny bit of command line stuff:

– Attach your iPhone to your computer. Let it sync. Leave iTunes open.

– Open Address Book, select all your contacts, then File->Export to your Desktop, call it “backup.vcf” — don’t touch this file — if something goes wrong you’ll restore this.

– Do a second export of all the contacts to another file “munged.vcf”, or some name equally meaningful to you.

– Open a Terminal window, and cd to your Desktop (“cd ~/Desktop”). Just for paranoia’s sake, type “more *.vcf” and use the space bar to step through the files, making sure they contain all your contacts. Type “ls *.vcf” to confirm the files are the same size. Yeah — sheer paranoia, but who wants to reenter all their contacts? 🙁

– In the previously opened Terminal window paste this command and press return:

cat munged.vcf | sed -e 's/EX-//' | sed -e 's/_$!<//' | sed -e 's/>!$_//' > fixed.vcf

– in the Terminal window type “more fixed.vcf” — confirm the ABLabel fields are corrected before going onto the next step. If the fixed.vcf file doesn’t look right, stop and consult a local Unix person. You did something wrong or your problem wasn’t the one I had. Bail out or get help.

– Go back to Address Book, select all the contacts (if not still selected), then Edit-> Delete Cards. Delete all your contacts. Paranoia now seems appropriate.

– Go back to the iTunes window. Select the iPhone in the Devices list on the left (if not selected), then select the Info tab at the top of the main window and scroll to the very bottom to the Advanced items, select Contacts under “Replace information on this iPhone:”. Click Apply and let the phone sync. Check the Contacts on the iPhone to see they are gone.

– Go back to the Address Book window and File->Import, selecting (you guessed it) “fixed.vcf” from your Desktop. Check the reloaded vcards/Contacts.

– Go back to the iTunes window, and again select the option to Replace the Contacts info, Apply, and let the iPhone sync.

– Try the Contacts on the iPhone, and the labels should be corrected. Delete all the ancillary files on your Desktop.

– Avoid whatever odd combination of things you did that caused the problem in the first place. 😉

In case you want to mess with any other fields/changes, vcard format is described here: http://en.wikipedia.org/wiki/VCard.

Reblog this post [with Zemanta]

MacDailyNews – Beleaguered Napster in search of new business model as subscriptions dwindle

MacDailyNews – Beleaguered Napster in search of new business model as subscriptions dwindleThere’s a really good chance that other companies are watching Napster on the subscription deathbed.  As Napster’s muscles twitch, consider whether or not iTunes should adopt this model.  Now go analyze, come back with your answers.