Menu

#78 Incorrect parsing for quote followed by space

v1.0 (example)
closed-out-of-date
nobody
None
5
2016-04-27
2011-09-30
Anonymous
No

This is NOT a duplicate of bug ID: 3217444 !

The following content is not parsed correctly:

[code]
"First Name,Last Name" ,Address
[/code]

The results is as follows:
first element:First, Name"
second element:Address

Note the the space after the quote and before the comma separator. Once this space is removed, the parser works fine.

Discussion

  • Anonymous

    Anonymous - 2011-09-30

    The result is actually like this:

    First, Name"
    Last Name

    The quote is not expected there.

     
  • Anonymous

    Anonymous - 2011-10-01

    It looks like at line #239 in CSVParser, the quote was appended to ythe returned value without checking the value of the variable 'inQuotes'.

    At the first glance, the code should be like this:

    [CODE]
    if (ignoreLeadingWhiteSpace && sb.length() > 0 && isAllWhiteSpace(sb)) {
    sb.setLength(0); //discard white space leading up to quote
    } else {
    if (!inQuotes) {
    sb.append(c);
    //continue;
    }
    }
    [/CODE]

     
  • Andrew Rucker Jones

    • status: open --> closed-out-of-date
    • Group: --> v1.0 (example)
     
  • Andrew Rucker Jones

    Cleaning up old issues. If this still needs attention, please open a new ticket.

     

Log in to post a comment.