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.

Close

#83 it should be allowed that quote are escape the same

open
nobody
None
5
2013-08-30
2011-11-02
Anonymous
No

This is a follow up to: "quote char is ignored when quote char=escape char - ID: 3030747"

It is now forbidden for CSVReader that the quote and escape character are the same. if the two are the same it throws:
"The separator, quote, and escape characters must be different!"

However http://tools.ietf.org/html/rfc4180 recommends that doublequotes within a doublequote enclosed field should be escaped by another doublequote.

In my case, I should process CSV files created by Excel. Excel does exactly this. It encloses fields in double quotes. It escapes doublequotes with a 2nd doublequote. So CSVReader can not properly process MS Excel CSV-Files.

Discussion


  • Anonymous
    2012-02-14

    Note also that the default CSVWriter has the quote and escape characters the same, being a double-quote. So, OpenCSV can write CSV files which it cannot read.

     
  • rborchert
    rborchert
    2012-02-14

    Actually, it works fine, just not the way you think. Its defaults are comma for separator, quote for the quote character, and backslash for the escape character. However, it understands two consecutive quote characters as an escaped quote character. So, if you just go with the defaults, it will work fine. I use it to read CSV files from Excel all the time, including with double double quotes.

     
  • bbabic
    bbabic
    2013-08-30

    JFTR, 2 and half years later, the same "bug" still exists.