删除“内容”之间的空格是否安全?和“字符集”?

发布于 2024-12-29 08:05:51 字数 315 浏览 0 评论 0原文

我已经搜索了一段时间,但没有找到任何关于是否安全/可能删除此处的空格的参考:

我还尝试压缩“积极最小化”上的脚本,但他们似乎没有删除它。

我看到他们删除了此网站示例上的空格。但我不能再依赖那种网站了。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

暖树树初阳… 2025-01-05 08:05:51

媒体类型规范 RFC 2045 不需要空格。它也不禁止空格;这更加隐含,因为 RFC 2045 引用了 RFC 822 中定义的扩展 BNF,RFC 822 在第 3.4.2 条中澄清了这一点。空白:

“注意:在结构化字段主体中,多个线性空间 ASCII
字符(即 HTAB 和 SPACE)被视为
单个空格,可以自由包围任何符号。在
所有标头字段,其中至少有一个的唯一位置
LWSP-char 是必需的,位于折叠字段中连续行的开头。”

根据 HTML5 草案,正在讨论的 meta 标签的具体类型可以写成以下更紧凑的形式,因为用户代理早已认识到它:

<meta charset=UTF-8>

如果需要 XHTML 序列化,请使用

<meta charset="UTF-8" />

这是更具可读性和更安全(手写时误输入的可能性更少)。

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:

<meta charset=UTF-8>

If XHTML serialization is needed, use

<meta charset="UTF-8" />

This is more readable and safer (fewer possibilities of mistyping when you type it by hand).

沉溺在你眼里的海 2025-01-05 08:05:51

只要有分号“;”就没有坏处。在text/html之后...

there is no harm in that as long as there is the semicolon ";" after text/html...

初见终念 2025-01-05 08:05:51

It looks like there used to be a bug in Exchange Web Server that required the space, but browsers in general don't care.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文