BurntSushi / BurntSushi/rust-csv
Allow escaping the delimiter
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
#### What version of the `csv` crate are you using?
1.1.6
#### Briefly describe the question, bug or feature request.
Allow escaping the delimiter like the [python counterpart](https://docs.python.org/3/library/csv.html#csv.Dialect.escapechar), e.g.
```
field1,field2,field3\, with\, commas,field4
```
This is to me, personally, the best format for CSV. No need for quotes or anything else, it's just a delimiter that can be escaped if used within a field. I currently have code in python that writes files like this, and I'm in need of reading them through rust. Of course this might be possible already, but I've not had any success with the `ReaderBuilder` options, also the `escape` function mentions escaped *quotes* only.
#### What is the observed behavior of the code above?
```
CSV error: record 19 (line: 19, byte: 5289): found record with 20 fields, but the previous record has 18 fields
```
I will link a PR to this issue which made it work for me, but the implementation of it is probably sub-optimal.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the ReaderBuilder options and the escape function mentioned in the issue, then trace how delimiters and escaped characters are handled while parsing records. Confirm the behavior against the Python-style example and the reported inconsistent field counts; done means escaped delimiters remain within one field without requiring quotes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100