-
Notifications
You must be signed in to change notification settings - Fork 76
Doesn't handle whitespace outside of quotes values correctly #19
Comments
Quick note: trimming is already supported with But I'll see what's up with eating of spaces... |
Hmmh. I am guessing that some spaces are missing from the example, due to Markdown? |
Actually it looks like I can reproduce this on my own. |
Hmmh. Reading through RFC 4180, I do not see definition of whether spaces would be allowed in the way described, outside quotes. But I think it would make sense to handle them in intuitive way. FWIW, enabled TRIM_SPACES should solve your specific problem I think, until I'll fix the issue for un-trimmed case. I assume that spaces outside of quotes should be trimmed anyway; does not make sense to make to leave them. |
Any update on this issue? I have same issue and even though this specific case (where delimiter is a comma) is solved by using CsvParser.TRIM_SPACES as stated above, it messes things up when input delimiter is a space. I can use two different mappers for different delimiters but then the indexes of fields change if the delimiter changes. So it'll be nice to see these spaces handled by Jackson CSV parser. |
Unfortunately no update yet. I realize this is an important feature, and hope to address it. |
When parsing a CSV file like:
the CSV parser will get confused and give me back exactly two values:
and
(note the leading space here).
According to RFC 4180, these spaces should be considered to be part of the value, e.g. it should return
'foo'
,' bar'
,' baz'
, and'baz'
,' foo'
,' bar'
.Alternatively - maybe via a feature - it could trim the whitespace outside of quoted strings, e.g.
'foo'
,'bar'
,'baz'
, and'baz'
,'foo'
,'bar'
.The text was updated successfully, but these errors were encountered: