9 ms·
TSV > CSV Way easier to parse
by lxe 2y ago
TSV > CSV
Way easier to parse
- emmelaich 2y agopipe (|) separated or gtfo! sqlite3 gets it right.
- BeFlatXIII 2y agoWhat do you like so much about the pipe?
- emmelaich 2y agoVisually similar to column separator in a spreadsheet. Less likely to appear in normal data. Of course you have to escape it but at the very least the data looks less noisy.
- hajile 2y agoI think pipe is better too. Typical latin fonts divide characters into three heights: short like "e" or "m", tall like "l" or "P" and deep like "j" or "y". As you may notice, letters only use one or two of these three sections. Pipe is unique in that it uses all three at the same time from the very top to the very bottom. No matter what latin character you put next to it, it remains distinct. This makes the separators relatively easy to spot. Pipe is a particularly uncommon character in normal text while commas, spaces, semicolons, etc are quite common. This means you don't need to escape it very often. With an escapable pipe, an escapable newline, and unicode escapes ("\|", "\n", and "\uXXXX") you can handle pretty much everything tabular with minimal extra characters or parsing difficulty. This in turn means that you can theoretically differentiate between different basic types of data stored within each entry without too much difficulty. You could even embed JSON inside it as long as you escape pipes and newlines. "string"|123|128i8|12.3f64|false|[1,2,3,4]|{key: "val"}|2025-03-26T11:45:46−12:00 Maybe someone should type this up into a .psv file format (maybe it already exists).
- billyzs 2y agoI already prefer using pipe as separator in logging; now you're telling me there is a chance that my logs can be automatically ingested as tabular data? Sign me up for this branch of the multiverse :)
- hajile 2y agoI forgot to add that you need a "\\" escape for when it appears before |, n, or u in text.