SQLite Forum

Is CSV parsing too liberal?
Login
I have quite some experience with CSV specifically and the habit is to either ignore text not within the quotes, or to add them to the quoted text (assuming a mistake on the creator's part).

Just produce such a reversed CSV file, or indeed the weirdly-quoted sample you gave, and open with or import it into Excel and Libreoffice or such - chances are you will see two different results but never an error or warning.

I even used to "hide" information in CSV files liek comments, by simply making the text I wish hidden be outside the quotes, so this file:   
"Value 1" this is a comment, "Value 2"   
would, to the Excel CSV importer look simply like:   
"Value 1", "Value 2"   
But, that is no longer the case. Newer Excel versions imported it as:   
"Value 1 this is a comment", "Value 2"   
which gives me chills, but anyway, that's besides the point. (Not sure if it is  still the case with the newest versions).

Also, risking seeming like a bit of a Steve: You are only feeling this pain because you have specifically broken the file to no longer conform to the specification and to have a BOM in the middle. This is a basic run-of-the-mill File-BUG, and the only reason you are wishing for a CSV import warning is because your booboo would have been easier to find with the warning. The warning is not going to make your day-to-day future life better, nor ours. It is not a worthwhile implementation.

My advice: Suck this one up son!   
(and learn from it, of course) :)