4 ms·
TSV has all those same issues. However, you just have less frequent need of a tab, so most of the escaping edge cases never come up. Those aspects are defined
by jwilliams 13y ago
TSV has all those same issues. However, you just have less frequent need of a tab, so most of the escaping edge cases never come up.
Those aspects are defined in RFC 4180 - just a lot of systems don't bother. How would you define a simpler data format?
- JulianMorrison 13y agoIt's a lot easier to administratively ban tabs/newlines in your data than it is to ban commas, and TSV doesn't have escape mechanisms or quoting. So you actually can parse it with line.chomp().split("\t"), and that doesn't break horrendously. TSV is streamable and minimally wasteful, I rather approve of it. Netstrings are better though if having sized data and nested data is needed. They are proof against all the ills of quoting and escapes.
- jwilliams 13y agoLargely agree. I was just picking up on "vastly superior". All the issues of line breaks, nulls, column lengths, headers still remain. You're adding the constraint that you can't use tabs or newlines in your data (to use a newline in your String, you'd need to escape it). In all other cases, you need escaping, and once you've assumed escaping then CSV and TSV aren't really any different.
- JulianMorrison 13y agoAlso, I should have known there was a RFC for CSV. Too bad that the main call for CSV data is from cranky old versions of Excel in the hands of non technical customers.