moissinac / csvfix

Automatically exported from code.google.com/p/csvfix
MIT License
0 stars 0 forks source link

TRailing comma bug #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
There is a bug in the CSV parser which means the field count is wrong when 
there is a trailing comma in the input, and the previous field was quoted. So:

A,"B",

should be three fields, but CSVfix thinks there are only two.

Original issue reported on code.google.com by nbutterworth1953@gmail.com on 14 Aug 2010 at 11:28

GoogleCodeExporter commented 8 years ago
If building from source you can fix this with the following patch: to
alib/src/a_csv.cpp. In the function CSVLineParser :: GetQuoted change:

if ( Peek() == mSep ) {
    Next();
}

to:

if ( Peek() == mSep ) {
    Next();
    mMore = true;
    return field;
}

Original comment by nbutterworth1953@gmail.com on 20 Aug 2010 at 10:02