Earlier quoted context omitted.
I don't understand why CSV became a thing when TSV, or a format using the nowadays weird ASCII control characters like start/end of text, start of heading, horizontal/vertical tab, file/group/record/unit separator. It seems many possible designs would've avoided the quoting chaos and made parsing sort of trivial.
Any time you have a character with a special meaning you have to handle that character turning up in the data you're encoding. It's inevitable. No matter what obscure character you choose, you'll have to deal with it
A love letter to the CSV format
331–340 of 711 posts
Re: A love letter to the CSV format
#332I've recently been developing a raspberry pi based solution which works with telemetry logs. First implementation used an SQLite database (with WAL log) – only to find it corrupted after just couple of days of extensive power on/off cycles. I've since started looking at parquet files – which turned out to not be friendly to append-only operations. I've ended up implementing writing events into ipc files which then pe…
Re: A love letter to the CSV format
#333Earlier quoted context omitted.
I don't understand why CSV became a thing when TSV, or a format using the nowadays weird ASCII control characters like start/end of text, start of heading, horizontal/vertical tab, file/group/record/unit separator. It seems many possible designs would've avoided the quoting chaos and made parsing sort of trivial.
Any time you have a character with a special meaning you have to handle that character turning up in the data you're encoding. It's inevitable. No matter what obscure character you choose, you'll have to deal with it
Even if you wanted them, we use backslashes to escape strings in most common programming languages just fine, the problem CSV is that commas aren't easy to recognize because they might be within a single or double quote string, or might just be a separator.
Can strings in CSV have newlines? I bet parsers disagree since there's no spec really.
Re: A love letter to the CSV format
#334I have to agree. It was pretty straightforward (although tedious) to write custom CSV data exports in embedded C, with ZERO dependencies. I know, I know, only old boomers care about removing pip from their code dev process, but, I'm an old boomer, so it was a great feature for me. Straight out of libc I was able to dump data in real-time, that everyone on the latest malware OSes was able to import and analyze. CSV is…
The following are all valid CSV, and they should all mean the same thing, depending on your point of view:
1) foo, bar, foobar
2) "foo", "bar", "foobar"
3) "foo", bar, foobar
4) foo; bar; "foobar"
5) foobar"foobar"
5) foo bar
Have fun writing that parser!
Re: A love letter to the CSV format
#335Just last week I was bitten by a customer’s CSV that failed due to Windows‘ invisible BOM character that sometimes occurs at the beginning of unicode text files. The first column‘s title is not „First Title“ then but „&zwnbsp;First Title“. Imagine how long it takes before you catch that invisible character. Aside from that: Yes, if CSV would be a intentional, defined format, most of us would do something different he…
Re: A love letter to the CSV format
#336I have written a new database system that will convert CSV, JSON, and XML files into relational tables. On of the biggest challenges to CSV files is the lack of data types on the header line that could help determine the schema for the table. For example a file containing customer data might have a column for a Zip Code. Do you make the column type a number or a string? The first thousand rows might have just 5 digit…
csv does not stop you from making the first line be column headers, with implied data types, you just have to comma separate them!
Re: A love letter to the CSV format
#337Earlier quoted context omitted.
The HTML 5 spec says exactly how you're supposed to deal with broken HTML files.
Yes, that is a single spec with correspondingly-small importance. Generally parsing html remains extremely difficult.
Re: A love letter to the CSV format
#338Earlier quoted context omitted.
I don't understand why CSV became a thing when TSV, or a format using the nowadays weird ASCII control characters like start/end of text, start of heading, horizontal/vertical tab, file/group/record/unit separator. It seems many possible designs would've avoided the quoting chaos and made parsing sort of trivial.
Any time you have a character with a special meaning you have to handle that character turning up in the data you're encoding. It's inevitable. No matter what obscure character you choose, you'll have to deal with it
Re: A love letter to the CSV format
#339Re: A love letter to the CSV format
#340Excel hates CSV only if you don't use the "From text / csv" function (under the data tab). For whatever reason, it flawlessly manages to import most CSV data using that functionality. It is the only way I can reliably import data to excel with datestamps / formats. Just drag/dropping a CSV file onto a spreadsheet, or "open with excel" sucks.
It inserts an extra row at the top for its pivot table, with entries "Column1, Column2, ...".
So if you export to CSV again, you now have 2 header rows.
So Excel can't roundtrip CSVs, and the more often you roundtrip, the more header rows you get.
You need to remember to manually delete the added header row each time, otherwise software you export back to can't read it.