4 ms·
I never got why TSV's aren't more popular. TSV's are exactly like CSV's but only use TABs instead of commas as delimiters. This simply and elegantly solves on
by pmoriarty 6y ago
I never got why TSV's aren't more popular.
TSV's are exactly like CSV's but only use TABs instead of commas as delimiters.
This simply and elegantly solves one major issue with CSV's, which is that commas are quite common in real data. TABs, in contrast, are not.
It's not perfect, but it's a simple, real-world solution that popular software packages (like Excel) which consume CSVs will readily recognize.
- jacobsenscott 6y agoThere's no upside. Tabs are common in real world data. If someone's csv library is naive enough to fail to quote a field with a comma it will also fail to quote a field with a tab. Changing the delimiter is just moving deck chairs around on the titanic.
- BlueTemplar 6y agoDepends if your data is mostly text or numbers. I'd say that commas are still more common, though one issue with tabs is that they are 'invisible'.
- fctorial 6y agoOr NSVs (null separated values). It doesn't have any downsides.
- masklinn 6y agoNSVs break any text-based tools e.g. not only is it hard to view them using standard tooling, you can't diff them either. And if you're going to use stupid separators, at least use US (0x1F), that's the entire point of that thing.
- fctorial 6y agohttps://prnt.sc/vf7699 https://prnt.sc/vf7699 This is how vim renders an NSV file. And I honestly don't remember the last time I edited a csv file by hand.
- Kwpolska 6y agoAnd this is how TextEdit does it: abc 123 CSV files are also editable and readable with basic GUI tools like TextEdit/Notepad. Users of CSV files are not just people who can use Vim or a hex editor, it’s a general-purpose format. I can’t read nor edit the file with TextEdit, Notepad might also make it hard. Software that assumes C-style strings (where NULL terminates a string) can’t process your file without a complete rewrite. And even with Vim, I had to type ^Vu0000 to get the NULL in there, which is much less comfortable than comma or tab. (No, I’m not adding a key sequence for NULL to my .vimrc.)
- auxym 6y agoOr ASCII 0x1E - record separator. They have a similar downside though: you can't easily type them and a lot of text editors won't render them by default.
- masklinn 6y ago0x1e (Record Separator) would replace the newline, for row values it's 0x1f (Unit Separator) you want.
- rattray 6y agoAre those human-editable? How do you insert a null character?
- cf 6y agoHard to edit from a text editor and requires using something specialised
- mcswell 6y agoI would think most TSVs are generated programmatically, maybe apart from a few test samples one might make in the progress of debugging one's code. And most programmers' editors that I've use allow you to insert tab chars, and visualize them as well (often as some sort of arrow). In my work (which has to do almost exclusively in language data, ASCII and otherwise), a tab should never appear in text; if it does, I replace it with a single (or multiple) space chars in a preprocessing step. I suppose the other place that one might encounter tabs is in computer programs, most notoriously in makefiles. (You can tell which side of the tabs vs. spaces delimiting argument I come down on.) But then I've never had to send a makefile inside a TSV file...
- x87678r 6y agoPSVs too. (Pipes)
- BlueTemplar 6y agoPipes don't auto-format your data in nice columns.
- yardshop 6y agoIt depends on your software. The V File Viewer does [0]. But the whole issue with alternative formats is getting widespread software support. 0: http://www.fileviewer.com http://www.fileviewer.com
- 08-15 6y agoTSVs are exactly unlike CSVs where it matters. The quoting rules for CSV are just bizarre, and also make it impossible to skip records without parsing every single field. TSV does the right thing: only three characters are special (line feed, tab, backslash) and to include them in fields, you escape them. This is totally unlike the mess that is CSV! I also don't get why TSVs aren't more popular. Ironically, even the only reason why CSV exists at all, MS Excel, likes TSV better. The only format that can be exported and imported without trouble is TSV, encoded in UTF-16 with a BOM. But everybody uses CSV anyway. Weird.