4 ms·
Null encoding is entirely uncovered by the CSV format - if you want to communicate nulls you need to have an internal convention - some sort of reserved string.
by munk-a 5y ago
Null encoding is entirely uncovered by the CSV format - if you want to communicate nulls you need to have an internal convention - some sort of reserved string. Quoting characters are pretty commonly agreed to be " (aka ") and escape characters are technically unnecessary. Deciding to support \\ and \n is a pretty nice thing to do since some producers and parsers will erroneously choke on mid-string newlines but the only character that actually needs to be escaped (the double quote) can just be doubled up as per RFC4180[1]. The indecision on escaping means that the literal character sequence "\n" is very hard to represent in CSV consistently this is an unfortunate malus of C programmers getting all up in the standard.
RFC4180 is an after-the-fact RFC to try and codify common practices in the industry so some tools may refuse to conform to it - but it's really clearly written and like... super short. If you've never read it just go ahead and do so since it lays things out with exceeding care.
1. https://datatracker.ietf.org/doc/html/rfc4180#section-2 https://datatracker.ietf.org/doc/html/rfc4180#section-2
- deleted 5y ago[deleted]
- alecst 5y agoI work with CSVs often and we usually just use blanks like item1,item2,,item4,,,item7 to represent nulls. What do you think the pitfalls are here? (Sincere question, wondering how we can improve.)