I've done this. Everybody hated it. Most text editors don't display anything useful with these characters (either hiding them altogether or showing a useless "uknown" placeholder), and spreadhseet tools don't support the record separator (although they all let you provide a custom entry separator so the "unit" separator can work). Besides the obvious problem that there's no easy way to type the darned things when som…
Yes, but nowadays this is just another bootstrap problem: editors don't support them because no documents use them, no documents use them because editors don't support them, and users scream and bawl because their cheese has moved. Using an editor with some good support for control-character-separated data would be pleasant, more pleasant than the usual experience of fiddling with CSV in a text editor. That said, ano…
ASCII Delimited Text – Not CSV or TAB delimited text
121–130 of 286 posts
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#122Earlier quoted context omitted.
TLDR: it's superior, but don't do it...
It is strictly less expressive, because it can't handle nesting. This makes it inferior.
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#123Earlier quoted context omitted.
Even ignoring additional time needed to send those extra characters, it also was a lot faster than those control-H's, and (I guess) caused way less wear on your printer.
That presumes you're going like A^HAB^HB; you could just emit foo, and then strlen(foo) ^Hs.
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#124Earlier quoted context omitted.
I'm looking at my English keyboard and it has Alt Gr...
Qwerty keyboards intended specifically for the US market (opposed to the UK for instance) frequently do not have AltGr keys. The thinkpad I'm using right now doesn't have one, and the Das Professional I have next to me doesn't have it either. Come to think of it, I'm not sure if I've ever owned a keyboard with an AltGr key.. To get around this, I have taken to using xmodmap to turn my right alt key into altgr.
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#125Earlier quoted context omitted.
ASCII 0-31 are called "control" characters so it should come as no surprise that you could type them using the Control key. Unit Separator is Control-_ (underscore) and Record Separator is Control-^ (caret), for instance. Most modern text editors won't pass through every control character. Vim lets me type the unit separator, but not the record separator, for instance. Control-C and Control-D, End of Text and End of…
Vim will let you type the record separator, but you may have to precede it with Ctrl-V. In other words, type the Ctrl-V Ctrl-^ key sequence. At least, that worked for me. Interesting that the unit separator does not have the same requirement to precede it with Ctrl-V. More info in the vim docs: http://vimdoc.sourceforge.net/htmldoc/insert.html#ins-specia...
You can also use Ctrl-K to enter RFC1345 digraphs, in which case unit separator is 'Ctrl-K US' and record separator is 'Ctrl-K RS'. (See :h Ctrl-K).
Emacs has similar features, as well as a nifty TeX input mode: http://stackoverflow.com/q/6269618
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#126CSV is a solved problem - RFC 4180: http://tools.ietf.org/html/rfc4180#section-2 As used by Lotus 1-2-3 and undoubtedly others before there was an Excel. Example record: 42,"Hello, world","""Quotes,"" he said.","new line",x Now go write a little state machine to parse it... (hint: track odd/even quotes, for starters)
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#127Don't do this. Tsv has won this race, closely followed by Csv. Anything else will cause untold grief for you and fellow data scientists and programmers. I say this as someone who routinely parses 20gb text files, mostly Tsv's and occasionally Csv's for a living. The solution you are proposing is definitely superior but isn't going to get adopted soon.
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#128Earlier quoted context omitted.
You know what's nicer than delimiting beginnings and ends of things? Length prefixing. Protocol message formats and data encoding formats both already know what they're going to say before they say it, and so know its octet length. The only reason to use delimiters, ever, is for user-modifiable data (e.g. source code) where you might want to insert or delete characters and have the containing block remain valid. ---…
The problem: I have never encountered length-prefixed data. Ever. Every data interchange file I've ever dealt with has been either delimited or fixed-width fields (and the widths are not defined anywhere in the file).
It's just these worse-is-better text-based protocols like HTTP, created by application developers, that toss all the advantages of length-prefixing away. (And, even then, HTTP bodies are length-prefixed, with the Content-Length header. It's just the headers that aren't.)
Re: ASCII Delimited Text – Not CSV or TAB delimited text
#129Earlier quoted context omitted.
...and that's why, when running a command that's reading what you're typing to stdin, you press Ctrl-D to tell it that you're done. Because, as your "man ascii" trick shows, this generates the "end of transmission" character. Similarly, Ctrl-L clears the screen in most Unix apps because that generates the "form feed" character, and on a line printer or paper-based teletype terminal, "form feed" means to advance to th…
what about Ctrl-C to break out of stuff? Does that correspond to an ascii control character?