-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Header names seem to be trimmed #31
Comments
Yes, header names are trimmed using same rules as values. To retain spaces, it would be necessary to either double-quote contents, or use escape mechanism (if enabled via |
That's a bummer. AWS writes it's detailed billing files making Tags into headers. Tags can have leading or trailing space so " Header" != "Header " != "Header". The Apache CSV parser handles this correctly (as well as most python ones). I love the Jackson Parser but there seems to be no way to make it work for this case. I did code up a crazy solution of reading String[] and making the first row create a header Map<String,Index> and then fake it out into thinking it was iterating Map<String,String> instead of String[]. But it's a lot of code just to work around this issue. I really believe that your interpretation of the CSV spec is correct. The problem is that no one else's is. Also a flag just to remove that hard coded trim would be pretty awesome. |
There is Would it also make sense to file an issue against AWS? (regardless of if Jackson can work with this). |
I could file an issue with AWS but I doubt they'll fix it. As far as I can tell disabling |
jackson-dataformats-text/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvParser.java Line 737 in 939c7f9
|
Actually it looks like even if it is enclosed in quotes that the above line will trim it. |
Hmmh. Ok, that seems wrong then. I do think enclosed spaces should be retained. |
@rdifalco Ok this took forever but I finally came back and implemented it with addition of |
If I have a CSV with a header row, the header names seem to be trimmed. For example:
The above will produce a map with the key "Padded" instead of "Padded ".
The text was updated successfully, but these errors were encountered: