adaltas / adaltas/node-csv

Escape comma inside a column

Open
#346 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
4.3k
Forks
299
Avg merge
16h 19m
Merged PRs (30d)
1

Description

Hi,

My raw data got a comma from a certain field, While I'm parsing the data it cause me to have a new column instead. How do you escape a comma inside a column to prevent this?

Here is a example of raw csv data

"test@email.org, test2@mail.com",email.org,none,bad
now the data returned from me is

[test@email.org,test2@mail.com,email.org,none,bad]

What I'm expecting is

["test@email.org,test2@mail.com",email.org,none,bad]

I tried to escape the comma by escape: '\\,' but it doesn't help

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the quoted-comma example through the parser API, using the raw CSV and expected array shown in the issue. Check the parser’s handling of quoted fields and existing documentation or tests for escaping; done means the quoted email field remains one column without requiring an unsupported escape option.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.