tab delimiter + blank cells = trouble
Brought to you by:
rgamble
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\).