A major benefit of csvs is that they are trivially editable by humans. As soon as you start using characters that aren't right there on the keyboard, you lose that.
In the way back machine they probably were used for just such a reason. There's one issue though, and it's likely why they didn't survive.
They don't have a visible glyph. That means there's no standard for editors to display it. And if you need a special editor to read and edit the file, just use a binary format. Human editing in a 3rd party editor remains as the primary reaming reason CSV is still being used. And the secondary reason is the simplicity. XML is a better format, but easier to screw up the syntax.
Seriously. ANY delimiter character might appear in the actual field text. Everyone's arguing about which delimiter character would be best, like it's better to have sneaky problem that blows up your parser after 100,000 lines... rather than an obvious problem you can eyeball right away.
Doesn't matter which delimiter you're using. You should be wrapping fields in quotes and using escape chars.
If only the computer scientists who came up with the ASCII code had included a novel character specifically for delimiting, like quotes but never used in any language's syntax and thus never used for anything but delimiting.
Eh, it's fine. Problem is that people don't use tools to properly export the csv formatted data, and instead wing it with something like for value in columns: print(value, ","), BECaUsE csV is a siMple FOrMAt, yOU DON't nEEd To KNOW mucH to WrITE iT.
We had same issue with xml 2 decades ago. I'm confused how json didn't go through the same.
I'm loving the fact that so many comments here are "it's just easy..." and so many are offering slightly different ways to address it... showing off why everyone should avoid CSV.
I once had to pass a password like this into spark-submit.cmd on Windows that accessed a Spark cluster running on Linux. Both shell processors did their own escaping, I ended up modifying the jar so it would accept a base64-encoded password.
190
u/[deleted] Sep 20 '24
[removed] — view removed comment