davidsantiago / clojure-csv

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

optional deactivation of quoting recognition #17

Closed gudesh closed 11 years ago

gudesh commented 12 years ago

Pseudo csv-files are not rare that do not quote strings. I have to work with them.

My experiments with disabling the quoting with setting quote-char to nil lead to an exception.

Would it be possible to enable such an empty quote-char or provide a boolean flage like "quoted-string?" ?

davidsantiago commented 12 years ago

This is not making any sense to me. If a csv file does not do quoting, it should sail through the parser without a problem. If you mean that you have files that use quote-causing characters in the content of fields, but without quoting the field, then this is a strange state of affairs, in that the fields of the file are restricted from containing certain characters, like newlines and commas. Perhaps that is OK for your file, but if that is the case, then you shouldn't need a CSV parser, as you could just split the file on line-breaks, and then split each line on commas (using for example, clojure.string/split-lines and clojure.string/split). The reason a CSV requires a specialized parser is specifically because of the way quoting can allow commas and newlines to be hidden in the contents of the fields. Absent quoting, there is no real parsing to do, just splitting.

Perhaps I have misunderstood what you need, but if not, for the moment I'm disinclined to modify the parser to accommodate this.