Bug 236125 - Import skips empty CSV cells
Summary: Import skips empty CSV cells
Status: RESOLVED FIXED
Alias: None
Product: kaddressbook
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-03 08:57 UTC by Ken West
Modified: 2010-05-08 04:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ken West 2010-05-03 08:57:25 UTC
Version:            (using KDE 4.4.2)
OS:                Linux
Installed from:    Ubuntu Packages

The import CSV function skips empty cells.

For example, with the following CSV file ...

"Email (preferred)","Business Phone","Formatted Name"
"fred@gmail.com","555 12345","Fred"
"wilma@gmail.com",,"Wilma"

... the business phone for Wilma is empty (represented by a zero-length string).

If this is imported into kaddressbook, using the mapping suggested by the first line of the CSV file, and ignoring the first line: a contact is created for Fred with phone and email as expected; a contact is created for Wilma, but the name is "" and the phone is "Wilma".

It's interpreted as if the last line was ...

"wilma@gmail.com","Wilma"

... that is, the second, empty field is ignored.

Changing the last line to ...

"wilma@gmail.com","","Wilma"

... produces the desired behaviour.
Comment 1 Tobias Koenig 2010-05-07 11:45:22 UTC
Hej Ken,

this bug has been fixed lately by a rewrite of the CSV parser.
However we can't backport this change to 4.4 branch, so you have to
wait for 4.5.

Ciao,
Tobias
Comment 2 Ken West 2010-05-08 04:20:18 UTC
Thanks, Tobias!

Until 4.5 hits the streets, the following shell command will work around the issue by translating NULL fields into empty string fields ('input-null.csv' and 'input-empty.csv' respectively) ...

sed "s/,,/,\"\",/g" input-null.csv | sed "s/,,/,\"\",/g" - > input-empty.csv

Ken