mperdeck/LINQtoCSV

Adding support for SeparatorChar inside quoted fields (Reading)

Closed this issue · 2 comments

I came across an issue while parsing a record like this one.
"RS9906762","RS","13-APR-2009","31-DEC-2014","CLASS "A" HEATING AND AIR CONDITIONING, INC."

I have my separator set to ',' and it breaks the code when it reaches this item.
"CLASS "A" HEATING AND AIR CONDITIONING, INC."
Right after the "Conditioning" it thinks it's a new item. This leads these records to have more items than others.

I don't know if the following will fix your problem, but I think your line should be:

"CLASS ""A"" HEATING AND AIR CONDITIONING, INC."

Could you edit the CSV file and give it a try?

When including " inside a cell, you should escape it by using "".

Thank you for your response, I settled for omitting records that caused errors while parsing. The CSV comes in malformed like that and I didn't really have the time to write something to parse the file for issues.

Again, thanks,
Brian