Menu

#36 Query export is not well escaped according to RFC4180

BeeBase V1.1
open
None
Linux
5
2024-10-02
2024-10-02
No

A double quote inserted inside a string field is not well escaped when the field separator is also a double quote. See RFC 4180.

2 Attachments

Discussion

  • Steffen Gutmann

    Steffen Gutmann - 2024-10-02

    Thanks for flagging this. I didn't know about RFC 4180 when I started this project :-)

    I guess the relevant section is this: "If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote."

    Actually BeeBase is doing this when the double quote in the field is at the end, is followed by another double quote or by the field or record separator. Otherwise, just a single double quote is written (since it is not ambiguous).

    I have tested that this allows to export and re-import records that have text containing double quotes. I wonder if other software also uses a similar rule (only escape a double quote when the next character makes the double quote ambiguous).

    It is easy to change BeeBase to conform to that section of RFC 4180 though (in a next release).

     
    • Stéphane Aulery

      I guess the relevant section is this: "If double-quotes are used to enclose fields, then a double-quote appearing inside a field must be escaped by preceding it with another double quote."

      Yes. Please note, with a customizable quotation character, this is the character that must be repeated.

      I wonder if other software also uses a similar rule (only escape a double quote when the next character makes the double quote ambiguous).

      I don't know of any software that follows the rule you describe. CSV is a format that is not really specified. One can find faults in most software.

      One good thing is that you chose to put all fields in quotes.

      I use CSV and its pitfalls when a user needs to be able to check the data or manipulate it with Excel. To exchange only between two programs I prefer json, XML...

       

Log in to post a comment.

MongoDB Logo MongoDB