(skeletor is leading by example by adding that unnecessary apostrophe…)

  • Waldowal@lemmy.world
    link
    fedilink
    arrow-up
    27
    arrow-down
    3
    ·
    9 months ago

    The CSV specification (RFC-4180) is pretty clear. If a value contains commas, you wrap it in double quotes. If the value contains double quotes, you double each double quote to indicate its part of the value and not the end of the value.

    A properly formatted CSV should have no problems from Skeletor!

    • danA
      link
      fedilink
      arrow-up
      24
      arrow-down
      1
      ·
      edit-2
      9 months ago

      There’s no formal spec for CSV. The RFC you mentioned describes the most common behaviour observed in many implementations, but it’s not a spec itself, as mentioned on the second page:

      While there are various specifications and implementations for the CSV format (for ex. [4], [5], [6] and [7]), there is no formal specification in existence, which allows for a wide variety of interpretations of CSV files. This section documents the format that seems to be followed by most implementations:

      Also, my understanding is that double quotes are only used for strings. Commas can appear outside of strings, for example in numbers in countries that use them as a decimal point. That’s actually why many implementations use semicolons or tabs as the separator.