-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Rows starting with comment char should be automatically quoted #362
Comments
Agree 100% and not even sure how we got this far forcing people to do that.
and for parsing:
But I'll adjust to allow writing the first value without having to set the comment character to Thanks for the suggestion |
This won't always work. Believe me or not, the initial issue I ran into was precisely with a row starting with If it's feasible for you, I would avoid mixing these two notions: |
You can also use the 0xFF character, which is probably more appropriate but
less common.
…On Fri, 22 Nov 2019 at 19:12, Alexandre Dutra ***@***.***> wrote:
parserSettings.getFormat().setComment('\0');
This won't always work. Believe me or not, the initial issue I ran into
was precisely with a row starting with \0, as in "\0foo,bar,qix" and my
parser was configured with \0 as the comment char (or rather, was
configured to consider no comment char). That row got written nicely, but
couldn't be read.
If it's feasible for you, I would avoid mixing these two notions: \0 as
the comment char, and no comment char at all. But that's another issue.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#362?email_source=notifications&email_token=ABWFQPRYAVRDMPT4ITIM2QDQU6LNTA5CNFSM4JPHCSMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE46YJA#issuecomment-557444132>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWFQPR4GXJMFRYC6ZU2SS3QU6LNTANCNFSM4JPHCSMA>
.
|
That's an option too, but I sometimes deal with data encrypted with weird algorithms, and |
Implemented in the latest 2.8.4-SNAPSHOT. Thanks! |
I ran into a corner case when exporting/importing CSV data. Consider the following format and parse operations:
The above will fail because the written row happens to start with the configured comment character
#
.I am currently using the following workaround when exporting data:
This makes the code above work as expected.
But I think it would be a good idea to make
CsvWriter
automatically quote the first field of a row if its value starts with the configured comment character. Because otherwise the written row is likely to be ignored when read with the same settings.The text was updated successfully, but these errors were encountered: