Menu

#3 tab delimiter + blank cells = trouble

open
nobody
None
5
2013-11-08
2012-03-30
No

I ran into a problem with tab-delimited files. If a cell is blank, parsing goes hay-wire. The problem seems to be here:
if (is_space ? is_space(c) : c == CSV_SPACE || c == CSV_TAB) { /* Space or Tab */
continue;
}
Note that tabs will get consumed as whitespace here, even if they are the delimiter. This change:
if ((is_space ? is_space(c) : c == CSV_SPACE || c == CSV_TAB) && c!=delim) { /* Space or Tab */
continue;
}
was sufficient to solve my problem and give consistently well-parsed TSV files.

Thanks for writing and publishing libcsv, I'm using it in a toolbox for diffing/patching/merging tables (see http://share.find.coop\).

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.