Skip to content

Stringify: Double quotes wrongly serialized #17

@andreschort

Description

@andreschort

Hi, great library!

Found an issue when serializing a field with more than one double quote.
For instance a value of John Dwayne "The Rock" Johnson is serialized as "Dwayne ""The Rock" Johnson".
When trying to parse that with CSV.parse it throws CSVError: Illegal state.

Code snippet:
const CSV = require('@vanillaes/csv'); const data = [ [ "header1", "header2", "header3" ], [ "aaa", "bbb", 'Dwayne "The Rock" Johnson' ], [ "zzz", "yyy", "xxx" ] ]; const stringified = CSV.stringify(data); const rows = CSV.parse(stringified);

Throws:
Error: CSVError: Illegal state [row:2, col:3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions