3 ms·
It's a damn shame that the control characters for "Field Separator" (FS ASCII 28 decimal) and "Record Separator" (RS ASCII 30 decimal) weren't used instead of T
by rswail 1y ago
It's a damn shame that the control characters for "Field Separator" (FS ASCII 28 decimal) and "Record Separator" (RS ASCII 30 decimal) weren't used instead of TAB and CR/LF.
Then the whole CRLF vs CR vs LF for line endings in files would have been totally avoided, with CR returning the print-head/cursor to the left-most position (right-most on R-L languages) and LF literally moving the print-head/cursor down.
The drivers for the particular terminal could have translated as required, and we would not need (in 2025!) to be specifying to git and elsewhere what to convert line endings to/from.
I know that back in the days of literal TTYs (ASR-33) where I cut my teeth, the BEL/BS/SP/CR/LF/FF etc characters were literally controlling a print head, but even then it didn't make much sense that we didn't have internal representation of what was needed (field separator, group separator, record separator) that was translated when doing actual I/O to a physical device.
- fecal_henge 1y agoAlso CSV files would not exist.
- rswail 1y agoComma Separated files would likely exist because they're human readable, whereas FS/GS/RS/CR/LF are not visible. There is "pipe delimited" which used "|" (ASCII 124 decimal) to separate fields, which actually makes way more sense, because that character is rarely used in normal text. It's also a good separator when a human is reading the file.
- bonzini 1y agoThey could be made visible. On MSDOS it was common to have editors show an arrow as ESC or EOF, respectively pointing left or right. A lone CR was a musical note. I am not sure whether RS could have replaced LF or CR+LF in this kind of free-format database; overloading record and line separators makes sense. But if FS-separated fields were a thing, people on MSDOS would have been used to seeing ⌙ as a field separator and likewise for other OSes.
- UltraSane 1y agoI prefer alt 1 (smiley face) as a field separator. It definitely is rarely used in text.
- paffdragon 1y agoWouldn't we still need a "Line Separator" character so we can include line breaks in fields and records for formatting purposes?
- rswail 1y agoRS separates logical "lines" or there is "Group Separator", but for internal line separators in a multi-line text field, the CR and LF characters could be used, because they have "standard" meanings for text: CR: move next character position to position 1 horizontally LF: move next character position to vertically below current character position, potentially inserting SP characters. So a combination of CR/LF, or LF/CR would have the effect of "New Line".
- Animats 1y ago> It's a damn shame that the control characters for "Field Separator" (FS ASCII 28 decimal) and "Record Separator" (RS ASCII 30 decimal) weren't used instead of TAB and CR/LF. No, it's not. That stuff is left over from 1940s-1950s schemes for polled multidrop teletype machines - multiple stations on one wire, taking turns. The idea was that you punched paper tapes locally and then put them into a reader. When it was your station's turn, the central machine would send a polling sequence of a few characters, the selected reader would start up, read one message into the upstream system, then stop. In the other direction, the central station could send a turn-on code to any machine, print a message, then turn it off. Only one machine at a time could run. Those control characters were the delimiters for that process. All of this was mechanical, done by a unit called the "stunt box", which you can look up if really bored. RS-485 is a descendant of that technology, still used in some industrial control systems. (I used to restore antique Teletypes for fun, and had a functional Telegraph Office at steampunk conventions for about seven years.)
- rswail 1y agoWhy? The use of TTYs for computing interfaces is very different to using them as teletypes on comms links. I thought the control characters for that sort of use were the DC1-4 characters? RS-485 uses polling but my understanding is that the characters for polling usually involve like "FF" (hex) and some sort of device ID. I just read a TTY model 28 manual about the stunt box and I didn't see anything specific about FS/GS/RS there. How were messages delimited in the polled multidrop environment?
- Borg3 1y agoBut we do NOT need to setup CRLF translation at all? Who in his sane mind uses CRLF even under windows? All my source codes are in UNIX format (aka LF only) and I use it consistent under Windows, Cygwin and UNIX.. Why make your life harder?
- saghm 1y agoI think the issue is that people don't make their own lives harder, but sometimes they make the lives of other people harder (often unintentionally). In my experience, the CRLF files I run into tend to come from developers who are only working in Windows and either aren't aware of the issue or don't particularly care to do anything about it. It isn't something I run into often when cloning a git repo, but having recently started dabbling in the world of mod development for games, there's a lot of stuff out there that seemingly has never been touched by someone who's used Linux before. To be clear, I don't blame anyone for this, since people working on things for free in their spare time shouldn't have to worry about anything other than what interests them, but it's a bit amusing to me that I sometimes have less to configure to run an .exe on Linux than I do to start editing the source for it in a way that makes it easy for me to merge any new changes that happen upstream.
- 1718627440 1y ago> I sometimes have less to configure to run an .exe on Linux than I do to start editing the source for it in a way that makes it easy for me to merge any new changes that happen upstream. Are you doing anything more than calling dos2unix?
- mathiaspoint 1y agoThe language runtime will insert/remove CR for you if you open the file in text mode on Windows. You'd be surprised how much stuff cygwin itself actually does for you. If your code isn't too Linux specific try building it under mingw instead and you can see what's actually going on.
- Borg3 1y ago
- arp242 1y agoEditing a file like that with a text editor is a right pain. Inserting these characters isn't all that straight-forward, and everything will be on a single line. In theory RS could be treated as a newline, which will only add to the line ending confusion. I think this is one of those things that sounds kind of nice in principle, but where the real-world practicalities just don't work out.
- BeFlatXIII 1y agoText editors should be programmed to support those separators. Would've saved us from CSV.
- rswail 1y agoThe file editing is an I/O issue, not a character issue. The I/O drivers could translate as necessary, that's the point of using an explicit character to mean "new line" as opposed to either "carriage return" or "line feed". Effectively moving away from explicit carriage and paper controls to a character that was explicitly internal to mean to generate whatever carriage/paper controls were needed on output/editing etc.