Skip to content
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

Always quote strings with leading/trailing spaces in CSV #210

Open
sfzhi opened this issue Jul 23, 2020 · 3 comments
Open

Always quote strings with leading/trailing spaces in CSV #210

sfzhi opened this issue Jul 23, 2020 · 3 comments
Labels
csv to-evaluate Issue that has been received but not yet evaluated

Comments

@sfzhi
Copy link

sfzhi commented Jul 23, 2020

I would like to suggest to add a feature flag to CsvGenerator, which, if enabled, would cause any string values that contain leading or trailing white space to always be quoted.
Some CSV parsers out there do not handle leading/trailing spaces very well, if unquoted. If Jackson needs to produce CSV for consumption by one of those parsers, currently it would have to resort to force quoting of all strings, which may be undesirable for a number of reasons.

@cowtowncoder
Copy link
Member

Does CsvGenerator.Feature.STRICT_CHECK_FOR_QUOTING not do that already?

@sfzhi
Copy link
Author

sfzhi commented Jul 24, 2020

As far as I have observed, it doesn't. I am guessing that's because quotes in this particular case are not strictly required.

@cowtowncoder
Copy link
Member

@sfzhi Thank you -- it does sound like there should be a way to force quoting, then; and if not done by default at this point, probably needs to be a new feature (if so, needs to go in 2.12.0).

@cowtowncoder cowtowncoder added csv to-evaluate Issue that has been received but not yet evaluated labels Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csv to-evaluate Issue that has been received but not yet evaluated
Projects
None yet
Development

No branches or pull requests

2 participants