Allow for escaping the delimiter like the python counterpart (Write) #234
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proof of concept for escaping the delimiter in Writer. However, it overrides the default of
QuoteStyle::Never
, i.e. it will rather escape than produce potentially broken CSV.One con of this, if you force
Never
because you know there is nothing to escape by quoting, it will still check if it has to escape something and if so escape using escape char. That's naturally going to be slower, although probably negligible.Another con is that the escape char will always be escaped when it's on
Never
. This breaks reading it if you don't enable escape in Reader after #233. I would likely need to add a new option to avoid these cons because escape is not anOption
in Writer.Basically, any delimiter/escape char is prepended with the escape char. E.g.
Examples below, note though that
\\
inStringRecord
is just escaped output for\
:Writing:
Reading with #233: