Incorrect parsing for quote followed by space
Brought to you by:
aruckerjones,
sconway
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.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
The result is actually like this:
First, Name"
Last Name
The quote is not expected there.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
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]
Cleaning up old issues. If this still needs attention, please open a new ticket.