phatcher / CsvReader

Extended version of Sebastian Lorien's fast CSV Reader
MIT License
300 stars 102 forks source link

error in parsing while " is firs char in row text and " is a part of column text #56

Open kashiash opened 6 years ago

kashiash commented 6 years ago

this row is parsed correctly:

6224613;SINUS POLSKA, MIEDZYRZECZ;

this is not parsed correctly: 6224613;"SINUS POLSKA", MIEDZYRZECZ;

but this is parsed corectly too:

6224613;SINUS "POLSKA", MIEDZYRZECZ;

this means that if column contains " at first character then i get error ... the csv is created by external source and i cant change this

phatcher commented 6 years ago

Looks like it might be a bug - see if this case is covered off by a unit test

jakubmaguza commented 6 years ago

https://github.com/phatcher/CsvReader/pull/61

I checked this issue, and it's as follow: If you have quote at the beginning of your field, then parser expects that next quote will be field closing quote. The only case for test to pass is to escape quote inside and add quote at the end of field like this: "good,Also\"good\",\"wrong\"\"Field\",goodToo". In that case wrong Field will be parsed properly. I will try to work on it if I may.