Hacker News new | past | comments | ask | show | jobs | submit login

A double byte end-of-line sequence was a bug to begin with. Just like ending files on ctrl-Z (yes, it is End-Of-File, but filesystems know where the end of the file is already).

These are just holdovers from teletype days and with Notepad being solidly GUI based it could have simply had a backwards compatibility mode for 'DOS' style files.

Incidentally, CR-LF and LF-CR are interchangeable on a teletype, but various windows software would respond totally unpredictable to that alternative, including some spectacular crashes.




> Just like ending files on ctrl-Z (yes, it is End-Of-File, but filesystems know where the end of the file is already)

Very old filesystems didn't track file sizes in bytes, just blocks, so a literal EOF byte was needed to know where to stop reading in the middle of the last block of 128 bytes or so.


Actually, I had to work with a line printer that didn't handle CR-LF but LF-CR. The printer was designed to have people rip of paper cleanly and the easiest way to do that is to have a button that locks the printer head on the left side, which causes it to engage a gearing on the line feeder which prevents it from moving. That allows a human to press the button and rip of the paper. The process was fairly fast and without it the linefeed would slip and you would rip out half of the paper from under the printer head. Unfortunately this also means if you issue a CR-LF you will first hear the printer head moving and then a jamming noise from the line feed followed by the printer blowing a fuse.

So any device that uses it usually requires a special adapter that converts CR-LF to LF-CR otherwise the printer could be damaged and buffers input while the printhead lock the linefeed.

The device was to my knowledge not very popular, incredibly old and irreplaceable as part of a legacy application written for an old 8bit computer system.


Are they really interchangeable? Moving the print head from the right side to the left could easily take two character times, and a teletype didn't have any buffering.


The combined time is equal, why would it matter what the order is?

http://hans.presto.tripod.com/scan/teletype/28_02.html

"Dependable carriage returns with only one carriage return and one linefeed signal" at 100 wpm.

Now I'm curious :)

I don't have a teletype handy though, I'm sure other HN'ers do.


It doesn't matter that the combined time was equal. What mattered was that both operations completed before the next character was printed. The carriage return and the line feed could happen in parallel, but I'm pretty sure that carriage return could take longer than line feed, at least in the worst case when the carriage was near the end of the line. So if you did the line feed first, the next character could print while the carriage was still returning.

We always played it safe anyway, by punching CR LF RUBOUT at the end of each line on a paper tape. The RUBOUT added a bit more delay before the next character was printed, so you could feel sure that it would print at the correct position.


I see what you're getting at. That the next character would start to be printed before the carriage return had completed with the sending side not respecting the fact that it had just sent a carriage return by waiting for a bit.

From what I remember most TTY drivers would automatically insert an appropriate delay after a CR because the LF is optional, you can happily overprint a line if you want.


I remember a system that overprinted about 5 characters to black out a password after you entered it. Good times.

The NUL character was useful for inserting a delay into the serial stream.


Hehe, security by obscure it y.

And in sync links (not TTY's those were mostly async with start and stop bits, more like HDLC style stuff) those nuls were mandatory, you had to send something.


The head wouldn't start moving until it got the CR, and if the LF comes after it would have 2/10 of a second to traverse the page. If the LF comes first it would only have 1/10 of a second.


Actually, no it isn't End-Of-File.

* http://jdebp.eu./FGA/dos-character-26-is-not-special.html

And SUB was ASCII's equivalent of U+FFFD.


Nice link, but even COMMAND.COM would see CTRL-Z as special, so I'm not sure why the author saw fit to make that claim, it's fairly well documented that plenty of DOS utilities did that and together with the core they make up the OS.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: