davidsantiago / clojure-csv

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

Problem with quoted double-quotes in field #18

Closed earljwagner closed 11 years ago

earljwagner commented 11 years ago

In file foo.csv, I have a single double-quoted field with quoted double-quotes: "A\"B\"C"

Running (csv/parse-csv (slurp "foo.csv")) gives me: (["B\"C\""])

Is this right?

Thanks for any help. Earl

davidsantiago commented 11 years ago

Basically, clojure-csv is working properly. Your CSV file is not properly formatted. In CSV files, double-quotes are escaped by repeating them, not with a backslash. If you rerun your file with (csv/parse-csv (slurp "foo.csv") :strict true), it will give you an exception.

earljwagner commented 11 years ago

Got it - thanks for clarifying this.

davidsantiago commented 11 years ago

No problem.