davidsantiago / clojure-csv

A library for reading and writing CSV files from Clojure
187 stars 35 forks source link

Commas inside quotes sometimes not ignored #42

Open BorisVSchmid opened 6 years ago

BorisVSchmid commented 6 years ago

Issue #36 is closed, saying that commas inside quotes are ignored, but in the below example that is not always the case.

Only difference between the three lines below is no space, a space after the first, or a space after the second comma.

(->> "1367-1369,\"[Bailliages of Arras, Avesnes, Aubigny and Quiéry]\",[Artois],"
    (csv/parse-csv))

(->> "1367-1369, \"[Bailliages of Arras, Avesnes, Aubigny and Quiéry]\",[Artois],"
    (csv/parse-csv))

(->> "1367-1369,\"[Bailliages of Arras, Avesnes, Aubigny and Quiéry]\" ,[Artois],"
    (csv/parse-csv))

The first line produces the expected results.

(["1367-1369" "[Bailliages of Arras, Avesnes, Aubigny and Quiéry]" "[Artois]" ""]) ​ But the other two lines seems to have issues. Either some overzealous splitting that didn't respect the double-quoted string, or just swallowing a whole entry.

(["1367-1369" " \"[Bailliages of Arras" " Avesnes" " Aubigny and Quiéry]\"" "[Artois]" ""])

(["1367-1369" " " "[Artois]" ""])