76 个字符成为电子邮件 MIME 部分长度限制 (RFC 2045) 的原因是什么?
RFC 2045 将编码数据的最大行长度定义为 76。但是,我找不到任何解释为什么它是 76。这个数字完全是任意的,还是背后有一些推理?
RFC 2045 defines the maxmimum line length for encoded data as 76. However, I cannot find any explanation as to why it is 76. Is this number entirely arbitrary, or is there some reasoning behind it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
RFC2822 是电子邮件的旧标准。
在RFC2822的2.1.1节中,可以找到原因如下:
它还会影响 MIME。
RFC2822 is legacy standard of EMail.
In section 2.1.1 of RFC2822, you can find reason as below:
It also affects MIME.
实际上,原始 RFC 822 定义了 72 个字符的限制,罪魁祸首是 电传打字机,它是早期计算机的标准输出设备。
您还可以“感谢”电传打字机,因为电子邮件(和 Windows)中的行终止符为 2 个字符,即 CR(回车)和 LF(换行)。
必须在每行末尾传输此序列,以便电传打字机将插入符号移动到位置 0 并将纸张向前推进一个刻度。
当 RFC 2822 废弃原始版本时,没有人使用电传打字机来呈现电子邮件,因此它被放宽了一点,以便适应默认的 TTY 监控设备。
Actually the original RFC 822 defines a limit at 72 characters and the culprit is a teletype, which was a standard output device with the early computers.
You can also "thank" teletype devices for the line terminator in emails (and Windows) being 2 characters, which are CR (Carriage Return) and LF (Line Feed).
It was essential to transmit this sequence at the end of each line in order for a teletype to move a caret to position 0 and advance paper one tick up.
By the time RFC 2822 obsoleted the original, nobody was using teletypes to render emails, so it was relaxed a bit in order to fit into a default TTY monitor device.
最大行长度 80(包括终止回车和换行)源自老式打孔卡,其中最多包含 80 列孔。
为什么是80?因为在任何书中,一行的长度很少超过 80 个字符(包括空格)。
它意味着最大行长度为 80,包括终止回车(将电传打字机或打字机的托架移动到最左边的位置)和换行(将纸张前进一行)。
由于 Base64 是 4 个字符的倍数,因此我们最终得到的最大值为 76,不包括 CR+LF。
另一个例子是 TLE(双线元素集),它描述了卫星的轨道。它只适合两张打孔卡。
由于CR(水平移动到最左边,保持垂直位置)和LF(垂直移动到下一行,保持水平位置不变)是两个完全独立的东西,所以我们仍然拥有它们。下一行应该从最左边的位置开始,不是吗?
对于粗体打印,一行被打印两次,它们之间只有一个 CR,即不推进纸张。因此标准顺序是先CR 再LF。
然而,老式的机械打字机通常先输入 LF,然后再输入 CR。
The maximum line length of 80 including the terminating carriage return and line feed originates from the good old punch cards which contained up to 80 colums of holes.
Why 80? Because in any book, a line is rarely longer than 80 characters including spaces.
It implied a maximum line length of 80 including the terminating Carriage Return (which moved the carriage of the teletype or typing machine to the leftmost position) and Line Feed (which advanced the paper by one line).
Since Base64 is in multiples of 4 characters, we end up with a maximum of 76, not counting CR+LF.
Another example is the TLE (Two-Line Element set) which describes a satellite's orbit. It fits on just two punch cards.
Since CR (horizontal movement to the leftmost, maintaining the vertical position) and LF (vertical movement to next line, keeping the horizontal position as is) are two fully independent things, we still have both of them. The next line should start at the leftmost position, shouldn't it?
For printing in bold, a line was printed twice with only a CR between them, i.e. without advancing the paper. Therefore the standard sequence is CR first and then LF.
However, the good old mechanical typing machine usually did the LF first and then the CR.
与用户界面有关的部分
http://en.wikipedia.org/wiki/Text_mode#PC_common_text_modes< /a>
基本上,80 个字符(通常是 25 或 30 行)是最常见的显示标准。 78 提供了一个合理的标准,因为这允许使用一些小装饰(边框)。
The bit to do with user interfaces
http://en.wikipedia.org/wiki/Text_mode#PC_common_text_modes
Basically, 80 characters across (and usually 25 or 30 lines) was the most common standard for displays. 78 provides a sane standard as this allows for some small decorations to be used (borders).