-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
In some cases, it is necessary to process CSV files that contain quotation marks within the field's enclosing double quotes. RFC 4180 explains this behavior as follows:
- If double-quotes are used to enclose fields, then a double-quote
appearing inside a field must be escaped by preceding it with
another double quote. For example:
"aaa","b""bb","ccc"
When encountering such a file, my quick/hacky fix in the CDL.java file was as follows:
case ''':
q = c;
sb = new StringBuffer();
for (;;) {
c = x.next();
if (c == q ) {
//Fix - check to ensure that this is not an escaped quote
if(x.next() != '"')
{
x.back();
break;
}
}
if (c == 0 || c == '\n' || c == '\r') {
throw x.syntaxError("Missing close quote '" + q + "'.");
}
sb.append(c);
}
return sb.toString();
Metadata
Metadata
Assignees
Labels
No labels