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

#36 Reading csv with escape char doesn't work

closed-fixed
Scott Conway
None
5
2009-09-22
2009-09-15
Ezio Pontiggia
No

Hi,
I have this csv line build with MS Excel:
field1;\=field2;"""field3"""
where there are 3 fields:
1) fiedl1
2) =fiedl2
3) "fiedl3"

I read this file with:
CSVReader reader = new CSVReader(file, ';',
CSVReader.DEFAULT_QUOTE_CHARACTER, CSVReader.DEFAULT_ESCAPE_CHARACTER);

and when I make reader.parseNext() I receive these fields:
1) fiedl1
2) fiedl2
3) "fiedl3"
where the 2° is wrong!

Thank you for any further help,
Ezio

Discussion

  • Scott Conway
    Scott Conway
    2009-09-19

    fix for this issue

     
  • Scott Conway
    Scott Conway
    2009-09-19

    Ezio

    The only characters that require escape characters are the given quote character and the escape character. So the equal sign does not need the slash. When I removed it I got the expected result.

    However I do agree with you that we should not be removing characters and attached a fix for opencsv 2.0. For the short term remove the slash.

    :)

     
  • Scott Conway
    Scott Conway
    2009-09-20

    Ezio

    Glen just release version 2.0.1 with this fix in.

    Hope this helps.

    Scott :)

     
  • Scott Conway
    Scott Conway
    2009-09-22

    • assigned_to: nobody --> sconway
    • status: open --> closed-fixed
     
  • Scott Conway
    Scott Conway
    2009-09-22

    fixed in version 2.0.1