通过Unix,Mac,DOS/Windows选择差异换行表示的理由是什么? [英] Rationale of choosing difference new line representation by Unix, Mac, DOS/Windows?

查看:100
本文介绍了通过Unix,Mac,DOS/Windows选择差异换行表示的理由是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道不同平台各自选择不同但又在某种程度上相似的新线表示形式的原始原理或故事吗?最初必须做出一些设计决策. (我不相信这全是随机选择...)

Does anyone know the original rationale, or story, of the different platforms each choosing a different, yet similar to some degree, new line representation? There must be some design decisions made originally. (I don't believe this is all random choice ...)

  • Unix/Mac OS X:LF(\ n)
  • Mac OS 9和更低版本:CR(\ r)
  • DOS/Windows:CRLF(\ r \ n)

推荐答案

Jeff Atwood在伟大的Newline分裂"

Jeff Atwood posted on this very topic in "The Great Newline Schism"

Wikipedia涵盖了换行的历史.

Wikipedia covers the history of newline.

简而言之,CR + LF是电动打字机的代名词,当您第一次使用回车将光标向左移动,并使用换行键向下移动一行时.您偶尔会只使用其中一个来编写特殊字符,例如下划线或删除线.

In short, CR+LF is a reference to the electric typewriter days when you would first use a carriage return to move the cursor to the left and a line feed to move down a line. You would occasionally just use one or the other for writing special characters such as underline or strike-through.

CRLF

计算机采用了这种命名法,因为它可用于与 teletype 机器进行交互.这就是为什么MS-DOS和随后的Windows使用CRLF的原因.

Computers adopted this nomenclature as it was useful for interacting with teletype machines. This is why MS-DOS and subsequently Windows use CRLF.

LF

很明显, Multics ,随后Unix从1963-64年ISO草案标准指出CRLF或LF都可以代表换行符,并且带有单个LF字符.

Apparently, Multics and subsequently Unix took their cue from the 1963-64 draft of the ISO draft standards which indicated that either CRLF or LF could represent newline, and went with the single LF character.

CR

我仍然对苹果采用CR的历史感到困惑.我正在调查... 到目前为止,我最好的猜测是这是由于苹果公司对 enter 返回.在早期,返回键映射为回车符,而回车键映射为换行符,而不是像Windows世界那样具有单一的输入"键来完成双重任务.对于通常使用回车符进行特殊格式设置的打字机用户来说,将二者分开是很有意义的,而苹果公司实际上将回车键用于特殊格式设置选项.

I'm still a bit puzzled about the history of apple adopting CR. I'm looking into it... So far, my best guess is that this is due to apple's early distinction between the enter and return keys. In the early days, the return key mapped to a carriage return and the enter key to a line feed, rather than having a single "enter" key that does double duty, like in the Windows world. To typewriter users, who would routinely use the carriage return for special formatting, this may have made sense to separate the two and apple did, in fact, use the return key for special formatting options.

我不确定的地方是,当他们放弃此方法时,他们只是使用CR了,但是我猜想这是早先决定使用CR作为返回键的原因了……但是我可能错了

Where I'm not so sure is how, when they abandoned this, they settled on just using CR, but my guess is it dates to this early decision to use CR for the return key...but I may be wrong.

这篇关于通过Unix,Mac,DOS/Windows选择差异换行表示的理由是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆