-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Disable line terminator config #331
Comments
I don't understand why you would not want to write a terminator. It is part of writing data in a CSV format. |
You're going to need to spell this out in more detail for me. I understand you've mentioned some tool called vector, but your motivation is described in terms of that project's vocabulary. It's high context and I do not have the time to obtain that context. So you're going to need to break this down at a more fundamental level before I can understand the actual problem being solved here. |
@BurntSushi When serializing a stream of events in a larger context the termination of such events may be handled in a different place. Still rust-csv can be used for encoding a single event. But at the moment this would forcefully add an additional termination character to the event which is not part of that events data. As the grammar of RFC4180 shows the terminator is not part of a record but of a file.Which is further empathized by paragraph 2.2 of said RFC stating the last line having no need for a terminator.
|
The terminators are record terminators. They aren't file terminators. The last terminator being optional doesn't change that. I still don't understand the need here. It doesn't make sense to me to use If you need this level of control, you can use |
I tinkered around with with |
What version of the
csv
crate are you using?csv: 1.2.2
csv-core: 0.1.10
Briefly describe the question, bug or feature request.
When using
wtr.write_field()
the following code fails sincewtr.write_record(None::<&[u8]>)?;
has not been called as documented. Adding said line not only adds the missing quoting character but additionally adds\n
to the respective line. Bothescape
andterminator
are configurable incsv::WriterBuilder
but is there a way to disable them entirely?Include a complete program demonstrating a problem.
no closing quote
additional line feed
desired behavior
some background for this request
At the moment I am trying to contribute to the open source tool vector. Specifically #17261. The tricky part is that the csv crate is only used as a line encoder since the so called framing is done independently by that tool.
https://github.com/vectordotdev/vector/blob/4b80c714b68bb9acc2869c48b71848d11954c6aa/lib/codecs/src/encoding/format/csv.rs#L78-L100
Therefore I am curious if there is a way to disable the terminator? If not I would be quite happy if the Terminator enum could add an additional special value implementing this behavior.
In regards to the
escape()
character from what I am seeing thecsv::QuoteStyle::Never
would likely disable all quoting / escaping? This would have been my second request to handle corner cases where such behavior is desired.rust-csv/csv-core/src/lib.rs
Lines 174 to 175 in 574ae1f
The text was updated successfully, but these errors were encountered: