删除“内容”之间的空格是否安全?和“字符集”?
I already searched for a while, and I failed to find any references on whether it is safe/possible to remove the space here:
<meta http-equiv="Content-Type" content="text/html;
this spacecharset=UTF-8" />
I also tried compressing the script on 'Aggressive Minimization', but they don't seem to remove it.
I see that they removed the space on this website example. But I can't rely on that kind of websites any more.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
媒体类型规范 RFC 2045 不需要空格。它也不禁止空格;这更加隐含,因为 RFC 2045 引用了 RFC 822 中定义的扩展 BNF,RFC 822 在第 3.4.2 条中澄清了这一点。空白:
“注意:在结构化字段主体中,多个线性空间 ASCII
字符(即 HTAB 和 SPACE)被视为
单个空格,可以自由包围任何符号。在
所有标头字段,其中至少有一个的唯一位置
LWSP-char 是必需的,位于折叠字段中连续行的开头。”
根据 HTML5 草案,正在讨论的
meta
标签的具体类型可以写成以下更紧凑的形式,因为用户代理早已认识到它:如果需要 XHTML 序列化,请使用
这是更具可读性和更安全(手写时误输入的可能性更少)。
The specification of media types, RFC 2045, does not require a space. Neither does it prohibit a space; this is more implicit, since RFC 2045 refers to the extended BNF as defined in RFC 822, which clarifies this in clause 3.4.2. WHITE SPACE:
“Note: In structured field bodies, multiple linear space ASCII
characters (namely HTABs and SPACEs) are treated as
single spaces and may freely surround any symbol. In
all header fields, the only place in which at least one
LWSP-char is REQUIRED is at the beginning of continuation lines in a folded field.”
According to HTML5 drafts, the specific kind of
meta
tags under discussion can be written in the following more compact form, on the grounds that user agents have long recognized it:If XHTML serialization is needed, use
This is more readable and safer (fewer possibilities of mistyping when you type it by hand).
只要有分号“;”就没有坏处。在
text/html
之后...there is no harm in that as long as there is the semicolon ";" after
text/html
...Exchange Web 中似乎曾经存在错误服务器需要空间,但浏览器通常不关心。
It looks like there used to be a bug in Exchange Web Server that required the space, but browsers in general don't care.