News for hackers. Stuff that matters.
Re:A love letter to the CSV format by emmelaich on Wednesday March 26, 2025 @02:22PM (#43485184)
pipe (|) separated or gtfo!

sqlite3 gets it right.

Re:A love letter to the CSV format by BeFlatXIII on Wednesday March 26, 2025 @08:02PM (#43488961)
What do you like so much about the pipe?
Re:A love letter to the CSV format by emmelaich on Wednesday March 26, 2025 @08:57PM (#43489315)
Visually 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.

Re:A love letter to the CSV format by hajile on Wednesday March 26, 2025 @08:59PM (#43489327)
I 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).
Re:A love letter to the CSV format by billyzs on Thursday March 27, 2025 @06:54AM (#43492227)
I 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 :)
Re:A love letter to the CSV format by hajile on Thursday March 27, 2025 @10:18AM (#43493931)
I forgot to add that you need a "\\" escape for when it appears before |, n, or u in text.