As for including commas in your data, it could just have been managed with a simple escape character like a \, for when there's actually a comma in your data. That's it.
As for including commas in your data, it could just have been managed with a simple escape character like a \, for when there's actually a comma in your data. That's it.
As a result spreadsheets almost always fail to automatically parse a CSV.
I do like the idea of having a dedicated separator character, that would work right worldwide. And then just standardize the use of a dot as decimal separator in these files.
Not quite. What if there is a \ in your data? Then you have to escape that.
No problem, any character following a `\` is a literal character. `\\` => literal `\`. `\,` => literal comma. `\a` => literal `a`, etc.
Parsing this is easy, generating it is easy, and there is only one rule to remember for humans reading or generating it.
Each rule added for parsing is one more added complexity and point of failure.
SomeCommas,MoreCommas,OnlyOneComma,ALotOfCommas
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
It will be difficult to find pathological cases for this grammar, because they don't exist.