News for hackers. Stuff that matters.
Re:Friends don't let friends export to CSV by Dalewyn on Monday March 25, 2024 @10:16PM (#39823665)
>I do hope "Unicode Separated Values" takes off. It's essentially just a slight tweak to CSV where the delimiters are special unicode characters

Commas can be typed by anyone on any keyboard and readable by anyone.

Special Unicode Characters(tm) can't be typed by anyone on any keyboard and readable by noone.

Convenience is a virtue.

Re:Friends don't let friends export to CSV by deathanatos on Monday March 25, 2024 @11:30PM (#39824025)
> Special Unicode Characters(tm) can't be typed by anyone on any keyboard and readable by noone.

While I'm not a fan of USV, I do believe it is type-able on both macOS and Linux¹. The IME's character picker in both OSes contains all of the necessary characters, I think. (I use "␤" in commit messages, occasionally. That was a typed ␤, not copy/pasted from a Google query or such.)

It would be quite tedious, I do admit; reasonably typed by someone, probably not.

I don't normally type out CSVs by hand either, though.

(¹I don't know about Windows as I simply haven't cared about it in years. For all I know, they've grown an IME in the intervening decade.)

Re:Friends don't let friends export to CSV by al_borland on Tuesday March 26, 2024 @12:35AM (#39824302)
Even if the csv isn’t being typed out by hand, when importing into Excel and the delimiter needs to be manually entered, because it isn’t one of the common ones Excel has a radio button for… it is nice to be able to easily type it.
Re:Friends don't let friends export to CSV by deathanatos on Tuesday March 26, 2024 @12:55PM (#39830097)
While I can see a convenience argument for the somewhat contrived case of typing an entire file out by hand, entering the character once for the import does not seem like a great bar.

> it is nice to be able to easily type it.

Again, that's where an IME is helpful; on the OSes I mention, it's "␞" is:

  macOS: ⌘+^+Space, "record", <arrows to select>, Enter
  Linux: Super+e, "record", Space, Space, <arrows>, Enter
The process is highly visual on both, so you're getting feedback about whether you're about to hit the right character, or not.

(And like, if you have the file, you can always ^C ^V the character, if say you don't know how to IME, or you don't know what the name of the char is, etc.…)

Re:Friends don't let friends export to CSV by bee_rider on Tuesday March 26, 2024 @12:06AM (#39824197)
Would it be possible to just type the file using commas, semicolons, or pipes or something (whatever you happen to know you don’t have in your file) and then convert them using sed?
Re:Friends don't let friends export to CSV by deathanatos on Tuesday March 26, 2024 @12:59PM (#39830153)
Yes, it would be possible. You'd have to make sure the character didn't appear / no escaping at all was present, which the data may or may not allow.

Might as well just get a dedicated CSV→USV converter, though.

(I have a variant of this problem in JSON→YAML … usually I just shove one into the other & pray, akin to your sed solution.)

Re:Friends don't let friends export to CSV by Dalewyn on Tuesday March 26, 2024 @01:04AM (#39824421)
Any character within reason can certainly be entered by way of Character Map in Windows or its equivalent in Linux or MacOS, but if you're arguing that then you don't understand the crux of my argument: Convenience is a virtue.

There is value in the delimiter simply being a key on practically any keyboard in existence. Anything that involves something more complicated than just pushing a single button on a keyboard (this includes IMEs) is a non-starter, because convenience is a virtue.

Re:Friends don't let friends export to CSV by adammarples on Tuesday March 26, 2024 @08:18AM (#39826914)
The fact that it is a character on the keyboard is exactly the problem, too. Any character a user can easily enter will definitely end up mixed into your data somewhere.
Re:Friends don't let friends export to CSV by deathanatos on Tuesday March 26, 2024 @12:50PM (#39830037)
> Anything that involves something more complicated than just pushing a single button on a keyboard (this includes IMEs)

My point is that this is merely a more stringent argument; it's now "on a keyboard, and cannot involve dead keys, etc." … which now excludes classic CSV, too, which requires two keys to enter a double quote. (Shift+')

Again, it does require more keys, and it is certainly not convenient, but n keys to me is still n keys. The real question is why one isn't using a proper tool to enter the data, and is instead encoding it by hand, which, again, even for a classic CSV, is basically something I've never done. (… because why would one?)

Re:Friends don't let friends export to CSV by hn_throwaway_99 on Monday March 25, 2024 @10:34PM (#39823753)
I can't remember the last time I, or anyone I've ever worked with for that matter, ever typed up a CSV from scratch. The whole point of USV is that the delimiters can't normally be typed so you don't have to worry about escaping.

USV supports displayable delimiters (see https://github.com/SixArm/usv), so for the much more common case of editing an existing CSV in a text editor, you can just copy and paste.

Re:Friends don't let friends export to CSV by albert_e on Monday March 25, 2024 @11:24PM (#39824005)
Everyone of us was a beginner at some point. The first time we came across CSV format we likely typed it in notepad by hand. A lot of issues with CSVs are also sometimes troubleshooted by hand-- by manually fixing a quote or a comma.

There is value is the ability to do this level of editing and troubleshooting.

Re:Friends don't let friends export to CSV by hn_throwaway_99 on Monday March 25, 2024 @11:44PM (#39824083)
> The first time we came across CSV format we likely typed it in notepad by hand.

Again, I'm not saying CSVs aren't edited by hand in a text editor, I'm saying they aren't created from scratch in a text editor, even by beginners. USVs are easy to edit in a text editor, too, and I tried viewing and editing USVs with a couple different fonts and had no problems.

Re:Friends don't let friends export to CSV by iainmerrick on Tuesday March 26, 2024 @04:54AM (#39825564)
If the separators can't easily be typed, how do you add a new cell?
Re:Friends don't let friends export to CSV by scbrg on Tuesday March 26, 2024 @08:31AM (#39827033)
Nobody can type up a GIF image, or Word document in a Notepad, yet files of both those formats exist. The answer obviously is tooling. If a format with sane separators was common, so would editors that could edit that format be.
Re:Friends don't let friends export to CSV by iainmerrick on Tuesday March 26, 2024 @08:52AM (#39827223)
I was responding to the GP's:

USVs are easy to edit in a text editor

I don't see how that's the case.

If a format with sane separators was common, so would editors that could edit that format be

Sure, but that's a hypothetical future editor, not something that currently exists.

Edit to add: I also disagree with "sane" in that context. New separators won't solve anything. You'll always need escaping/encoding/encapsulation; get that right and everything else follows. JSON is comma-separated and does just fine.

Re:Friends don't let friends export to CSV by hn_throwaway_99 on Tuesday March 26, 2024 @09:50AM (#39827815)
Copy and paste.
Re:Friends don't let friends export to CSV by eviks on Tuesday March 26, 2024 @02:29AM (#39824779)
No we didn't, we likely typed in Excel by double clicking on our first csv
Re:Friends don't let friends export to CSV by hnlmorg on Tuesday March 26, 2024 @03:35AM (#39825089)
I can’t speak for everyone, but I definitely didn’t use Excel.
Re:Friends don't let friends export to CSV by Dalewyn on Monday March 25, 2024 @10:37PM (#39823774)
I've valued the virtue of CSVs being readable by any text editor known to man, and I've occasionally edited them by hand. The pure simplicity of reading and typing commas trumps any value provided by more esoteric configurations.

As for escaping, that's for the subsequent programmers (which could also be me) to figure out. If it is me, I'll deal with it because it keeps things simple.

Re:Friends don't let friends export to CSV by groestl on Tuesday March 26, 2024 @05:10AM (#39825667)
> I've occasionally edited them by hand.

Yeah, usually when the quoting was f'up.