Google Sync fails if any contacts contain quotes

by Nelu Lazar

I usually sync Google contacts and calendar to the BlackBerry using Google Sync. This will end June 24, due to switching to iPhone, but until then I’ve noticed that, since a few days ago, the contacts won’t automatically sync anymore on the BlackBerry.

After a few failed manual sync attempts, the next option was to update via BlackBerry Desktop Manager, with the phone connected via USB.

Assuming there was an issue with the phone’s contacts list, I have deleted them all and attempted to sync them from an exported Google contacts CSV file.

It didn’t work. Entries in the contacts list on the phone were uploaded all scrambled up, fields’ data didn’t match with what it supposed to be displayed there.

Decided to try again, and this time to check on the option in the BlackBerry Desktop Manager that allows you to quickly review the items that are about to be synced.

The top entries did show up well, but while scrolling down I’ve noticed that, starting with a specific entry, the fields began to contain mixed data that belonged to other fields.

After reviewing in Google Contacts the last entry that showed up well in the list of items almost ready to be synced, I’ve noticed that one of its fields contained a text with… quotes.

Name: John Smith
Company: Apple, Inc.
Title: “Lorem ipsum dolor sit amet…”

Peeking inside the CSV file I was importing from (and that was exported from Google Contacts) I’ve noticed that the quotes from the title field were doubled and the entry looked like this:

[...] John, Smith, “Apple, Inc.”, ““”Lorem ipsum dolor sit amet…“”“, [...]

The first quote from the Title field is a standard CSV character that acts as a delimiter for the data that belongs to a specific field.

But the other two quotes supposed to tell the sync application that there was a quotation mark included in that field’s text.

It eventually did not work this way, so the sync application thought that the second quote is the end of the previous field, so it moved on to parsing the data from the following fields. This wrongful assumption ended up scrambling the next data processed to be imported on the phone.

There were three options to fix this:

  • in Google Contacts – search for quote character (“) in the contacts list and remove it or replace it with another special character.
  • in the exported CSV file – search for triple quotes (“”") and replace them with a single quote (“) before attempting to sync again.
  • in the Sync App – ask the sync application’s developers to parse the CSV data correctly.

I picked the first one, then successfully synced wirelessly via Google Sync, like it used to work before adding the entry with quotation marks.

Both Google Sync and BlackBerry Desktop Manager seem to process well the Calendar entries containing quotes, so it must be just the Contacts sync process that would eventually need to be fixed.

Tags: , , ,

CONNECT PROJECTS ABOUT CREDITS

© 1997 | Reloaded since 2010 with new random thoughts