Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
To make Super CSV quote all fields (regardless of whether they contain embedded commas, quotes or newlines) you have to create your own writer (as shown on this StackOverflow question).
We should add a CsvPreference ('alwaysQuote'?) that does this.
In addition, it might be worth considering how to do this for individual columns (which Kasper is keen on). It should be trivial to do it globally (for all columns), but not so easy per column (you can't just do it in a cell processor as the quotes will be escaped!).
Kasper B. Graversen
well, we could have a bool pr column which determines if there is a need for quoting. then a cell processor can easily be written which tells that there is no need for additional quoting. similarly for the numberparsers. maybe the introduction of said flags will even slightly speed up the writing process .
Okay, I've implemented this.
You can now supply a QuoteMode. Quotes are still applied if the column contains special characters (comma, quote or newline), but you can enable them if you want them using AlwaysQuoteMode (always quotes), ColumnQuoteMode (always quotes particular columns, using a boolean array), or a custom mode.
I've also allowed for a custom CsvEncoder (the default encoder uses the supplied QuoteMode), so users can write their own encoding if they want (you could avoid escaping altogether if you really want). The default encoder is pretty powerful though, as it keeps track of the line numbers (including embedded newlines in CSV data) which can be very handy.
[r275] and [r277]