Why documents writted in differents OSs have differents line endings characters? Are any technical reason behind this or the creators put distintinct characters just because they want.
Why documents writted in differents OSs have differents line endings characters? Are any technical
Share
As usual with issues of this kind, it’s historical. In early days of computing when the concept of a device driver was not fully formed yet, ASCII text files were basically instructions for teleprinters (TTYs). Since the device needed to perform two movements (feed an extra line to move down and then return the carriage to the left side) to add an extra line, two characters were included in files (sometimes more characters were added to give the devices extra time to position the carriage).
Early standards by both ISO and ASA/ANSI enshrined
CR+LFcombination.When Multics was written, it incorporated device drivers which could easily handle the translation of characters into instructions for a device and it was decided that
LFis enough. Device drivers were mapping newline toCRfollowed byLFwhen sending instructions to the device and so users would only storeLFin the text files. This was later adopted by most modern operating systems (Linux, UNIX, Mac OS X) with the exception of Windows which kept the old convention.One fact worth noting is that these were not the only two competing conventions in the early days. For example, EBCDIC-based systems used character
NEL(0x15) to indicate newline. Also, some of the ASCII based systems, usedCRalone. See this wikipedia article for more details.