Dear collegues. Please add support escaped-string for string values of columns.
Now the following text:
Test \"1"
write to file as :
"Test \""1"""
should be a write to file for escaped-string:
"Test \\"1\""
I tried to write your Encoder class, but this did not work as i wanted. I think, need to write special cell processor for string, wich will converts text to escaped-string. But this is requires that the Encoder is not encoded special characters in the text while writing to file.
Prompt, how do it.
Best regard,
Alexsey Konstantinov
Hi,
Super CSV does not use the backslash (
\) character to escape quotes - that's not part of the CSV specification (RFC4180). I'd recommend against escaping this way, as it will make your CSV file less portable as other people might not be able to read it.You can see how Super CSV encodes CSV here.
If you really really want to escape with backslashes, I believe opencsv supports this.
Last edit: James Bassett 2013-12-02
Well, you are right, escaping is not a part of an RFC.
But RFC is not really respected nowdays. For example, fgetcsv() function in PHP supports reading non-conformant CSV files with such escaping: http://php.net/fgetcsv
Migrated to GitHub issues: https://github.com/super-csv/super-csv/issues/14