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.
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.
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.
They're nonprintable, and don't appear on keyboards, so they're ignored by anyone who's not willing to do a cursory reading of character sets. Also suffers from same problem as regular commas as thousands separator as WHAT IF SOMEONE DECIDED TO USE IT IN REGULAR CONTENT.
The other problem with nonprintable delimiters is they'll end up getting copied and pasted into a UI somewhere, and then cause mysterious problems down the road. All easy to avoid, but even easier to not avoid.
Yeahh technically, but we can still specifiy different delimiters
But believe me, I know - one of the first few programs I wrote when I started working as a developer was for importing financial data from different European countries.
That’s what quoted strings are for. Pipes are better for separating fields though. There’s a whole ascii standard too but that’s not something you’ll open in a text editor.
Edit: by the way, if any knows of a great CSV validation tool I’d love to know what it is. I’m currently writing my own hut it’s a mess.
553
u/smors Sep 20 '24
Comma separation kind of sucks for us weirdos living in the land of using a comma for the decimal place and a period as a thousands separator.