haskell-hvr / cassava

A CSV parsing and encoding library optimized for ease of use and high performance
http://hackage.haskell.org/package/cassava
BSD 3-Clause "New" or "Revised" License
223 stars 107 forks source link

Allow unescaped characters or strings (e.g. double quotes) in ToField #74

Open spl opened 9 years ago

spl commented 9 years ago

I would like to make a CSV containing a field with hexadecimal digits. This field should always be treated as text by Microsoft Excel, but Excel converts number-like text into numbers by default (e.g 55e2 is converted to 5500). There is a workaround using double quotes ", but double quotes are escaped by Data.Csv.encode.

Is there any way to prevent or control escaping during encoding?

I think this feature request is much like the one for #68.

tibbe commented 9 years ago

Would a global DecodeOptions option do (i.e. never quote any fields) or do you need per-field control?

spl commented 9 years ago

I would prefer to have more fine-grained control over my output. (Considering how broad the formats and uses of “CSV” are, I can imagine others would find that useful, too.) So, I would prefer a per-field option, e.g. do not do escaping.

kirillt commented 4 years ago

Is there something like this after 5 years passed? Even global mode would be useful, e.g. for loading a list of users with password from a file with lines like this:

user,password
qwerty,%6y2"7""a;'_1)9