-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
CDL.toJSONArray(String csvString) won't work with Windows style line breaks (CR LF) #320
Comments
It would be reasonable for CDL.java to support Windows line breaks. |
Please provide a pull request if you still want this change to be in the code. |
CDL export to CSV format need field1;field2;field2;.... but in CDL.rowToString() is "," harcoded parser
change this "," with a parameter in this function ? |
No objections if someone wants to try a solution. If so, please post a pull request. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discovered this when using json-20090211.jar and reading a csv file created and saved in Windows 7.
Can be reproduced with an actual CSV file that contains CR LF line breaks or a crafted test string.
Example:
String csv = "label1,label2,code1\r\n" +
"name,surname,12345\r\n" +
"name1,surname1,12346\r\n" +
"name2,surname2,12347";
JSONArray json= CDL.toJSONArray(csvAsString);
In the above example the 'json' object is going to be null.
The current workaround for me is calling csvAsString.replace("\r\n", "\n") before I feed the string into CDL.
Let me know if you need more info.
Thanks,
Valdis
The text was updated successfully, but these errors were encountered: