Issues with ignore_last_delimiters
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 4.3k
- Forks
- 299
- Avg merge
- 16h 19m
- Merged PRs (30d)
- 1
Description
Describe the bug
ignore_last_delimiters: true seems to have some issues:
- If you don't use
relax_quotes: truethen it fails withCsvError$1: Invalid Closing Quote: got "," at line 4 instead of delimiter, record delimiter, trimable character (if activated) or comment - If you use
trim: trueorrtrim: truethen it fails withCsvError$1: Invalid Closing Quote: found non trimable byte after quote at line 4 - If you avoid the two issues above then the final string ends up with extra quotes and the final delimiter, e.g.
"'123123-12312312",(the double quotes are part of the string)
To Reproduce
const fs = require('fs');
const csv = require('csv');
const INPUT = `
Date, Type, Description, Value, Balance, Account Name, Account Number
11/02/2022,BAC,"'FOO",10.00,33432.80,"'REF","'123123-12312312",
`;
const stream = csv.parse(INPUT, {
skip_empty_lines: true,
ltrim: true,
rtrim: true,
columns: true,
relax_quotes: true,
ignore_last_delimiters: true,
});
Additional context
- node version: 16.14.0
- csv version: 6.0.5
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
Start with the csv.parse entry point and run the provided reproduction using the listed parser options. Trace the ignore_last_delimiters handling for quoted final fields, then verify that the three reported cases parse without errors and that the final value contains no extra quotes or delimiter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100