by AdmiralAsshat · 5y ago · 0 comments
So, question to the greybeards: when this format was coming about, why didn't we use one of the dedicated Data Structure separator control codes (e.g. File/Group/Record/Unit separator) that were part of the ASCII standard?
https://en.wikipedia.org/wiki/C0_and_C1_control_codes#Basic_...
It seems like it would've saved us all several decades of headache.
But commas can be seen, edited, and typed with ease in any text editor.
As per comment above: your CEO, SWE, or secretary can all use or contribute to a csv file. And using an easily recognizable and typeable separator has proven to be worth the downsides.
Consider also that IBM EBDCIC and other non-ASCII character sets were (and are) in common use, so C0/C1 may not have made sense 'back in the day'
Because you can't see them. CSV is, at its core, a text format. Using FS/GS/RS/US would effectively make it a binary format.
Also, what happens if one of those bytes appears in data?
The simple fact is you will never be able to come up with a text-based format that can handle all possible values without escape sequences, quoting, or length-encoding. And really, that's not that big a deal. It just means you have to write a simple state machine instead of using regex or your language's equivalent of split().