mafintosh / mafintosh/csv-parser
Double quotes in double-quoted values not handled correctly
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
Double quotes inside double-quoted values cause the parser to stop parsing at the row containing the double quote. When I run this:
`printf 'name,age\njoe,40\n"will"iam",30\n"sam",35\n"jan",25' | csv-parser`
`-------------------------------^ there's a double quote in here`
I get this:
```
{"name":"joe","age":"40"}
{"name":"will\"iam","age":"30\n\"sam\""}
```
It escaped the double quote nicely, but the "age" field is wrong, and the third and fourth rows were never parsed at all.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided printf input piped to csv-parser, then trace how the parser handles double-quoted fields containing an internal quote. Done means the sample produces four rows, with the will"iam name preserved and the age values assigned to the correct rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100