Skip to content

CSV output invalid escape sequence #2007

@OJFord

Description

@OJFord

ledger csv renders escaped quotes inside fields (for example, from a description John's Hardware - bought 2" rubber nails) as \". Per the grammar in RFC4180, and common parsers, this is incorrect, and should instead be a sequence of two double quotes "" (as mad as that is).

Concretely:

2021/1/1 John's Hardware - 2" rubber nails
    Expenses:DIY     -123
    Assets:Credit

renders:

"2021/01/01","","John's Hardware - 2\" rubber nails","Expenses:DIY","","-123","",""
"2021/01/01","","John's Hardware - 2\" rubber nails","Assets:Credit","","123","",""

but we expect:

"2021/01/01","","John's Hardware - 2"" rubber nails","Expenses:DIY","","-123","",""
"2021/01/01","","John's Hardware - 2"" rubber nails","Assets:Credit","","123","",""

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