6.0.0-alpha12
6/8/25

[#2742] Addressbook import fails with CSVs with newlines
Summary Addressbook import fails with CSVs with newlines
Queue Turba
Queue Version 2.0.3
Type Bug
State Not A Bug
Priority 1. Low
Owners
Requester horde (at) apocalyptech (dot) com
Created 10/06/2005 (7185 days ago)
Due
Updated 10/06/2005 (7185 days ago)
Assigned 10/06/2005 (7185 days ago)
Resolved 10/06/2005 (7185 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
10/06/2005 09:52:42 PM Jan Schneider State ⇒ Not A Bug
 
10/06/2005 09:06:29 PM horde (at) apocalyptech (dot) com Comment #4 Reply to this comment
Bah, yeah, upgrade to PEAR's File 1.2.2 seems to have done the trick.   
Thanks again!
10/06/2005 08:58:37 PM horde (at) apocalyptech (dot) com Comment #3 Reply to this comment
Install the File package from PEAR.
Hm, I've got that installed already, though it seems the version is a 
bit behind the 1.2.2 available @ pear.php.net.  I'll try an upgrade.   
I *do* see a File/CSV.php in there, though, so perhaps it's just an 
old Pear bug.  I'll let you know, thanks...
10/06/2005 08:33:52 PM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Install the File package from PEAR.
10/06/2005 08:20:32 PM horde (at) apocalyptech (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Addressbook import fails with CSVs with newlines
Queue ⇒ Turba
Reply to this comment
If a field in a CSV file to be imported contains newlines (even when 
they're enclosed inside quote characters), Turba won't import that 
row, and will generate a warning on the screen like so:



Warning: Read wrong fields number count: '78' expected 92 in 
/usr/local/www/mod_php/lib/php/PEAR.php on line 842

Warning: Read wrong fields number count: '1' expected 92 in 
/usr/local/www/mod_php/lib/php/PEAR.php on line 842

Warning: Read wrong fields number count: '1' expected 92 in 
/usr/local/www/mod_php/lib/php/PEAR.php on line 842

Warning: Read wrong fields number count: '3' expected 92 in 
/usr/local/www/mod_php/lib/php/PEAR.php on line 842



In this case, the CSV is from an export of an Outlook 2003 "XP" 
addressbook, and the 79th column (out of 92) is a "Notes" column which 
happens to have some newlines in it.  As you can see, it grabs the 
first 78 columns and then tries to process each line of the continued 
Notes field as a new addressbook entry.  Looking at the file itself, 
the entry snippet looks something like:



...... "foo","bar","baz","Here's

some

data:

Saturday, September 21, 2002 11:02 PM

etc","frob",.....



As you can see, the newlines are enclosed inside the quote character 
(which I had specified on the first screen of the address book import).



The most obvious response would, of course, be simply "Don't Do That," 
but unfortunately Outlook apparently doesn't have any options which 
would let you exclude the Notes field, or fields with newlines, etc, 
and so fixing the file from the user's perspective becomes a matter of 
opening the file in a spreadsheet app and pruning out troublesome 
columns, which simply isn't something you could ask of a larger, 
fairly computer-illiterate userbase.



I'll see if I can look at patching it up myself in a bit, figured I'd 
put this here for posterity now though.  Thanks!



-CJ

Saved Queries