URL中的HTML5模糊&符号 [英] HTML5 ambiguous ampersands in URLs

查看:223
本文介绍了URL中的HTML5模糊&符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

W3C Validator 在我的某些网址中引发了一个关于&符号的错误。例如:

The W3C Validator is firing up an error about ampersands in some of my URLs. For example:

<link href="min/?f=static/css/reset.css,static/css/main5.css&2" rel="stylesheet">

根据 HTML5规范,但验证器错误:


不明确的&符是U + 0026 AMPERSAND字符(&),后跟一个或多个字母数字ASCII字符,后跟一个U + 003B SEMICOLON字符(;) ,其中这些字符与命名字符引用部分中给出的任何名称都不匹配。

An ambiguous ampersand is a U+0026 AMPERSAND character (&) that is followed by one or more alphanumeric ASCII characters, followed by a U+003B SEMICOLON character (;), where these characters do not match any of the names given in the named character references section.

此网站得出了相同的结论,并指出目前没有验证器正确实施规范。

This site comes to the same conclusion and states that no validators currently implement the spec correctly.

这有什么明确的吗?

推荐答案

我相信你是对的 - 根据跟随线程,这是 HTML5验证器中的错误 。我不知道这是否是权威性的,因为它不是官方声明(但我认为答复中的名字至少是SO上信誉好的成员的名字)。

I believe you're correct - according to the following thread, this is a bug in the HTML5 validator. I don't know if this is "definitive" as it's not an official statement (but I recognise the names on the replies as those of reputable members here on SO at least).

您尝试做的事情确实在HTML5中有效(在特定情况下,例如您的)。

What you're trying to do is indeed valid in HTML5 (in specific cases, such as yours).

这是一段摘录从该错误报告中获取参考:

Here's an excerpt from that bug report for reference:

原帖帖子:

<img src="http://codx.altervista.org/scripts/php/image.phpimg=/membri/codx/grafica
/articles_covers/cover_t3dc1360866428.jpg&h=96" alt="Teeter 3D contesT" />




简单地说,&不必转义为& amp; - 来源

"Simply, that & does not have to be escaped to &amp;" - Source.

主题回答/解释 >


这是正确的,在HTML5中。这是验证器中的一个错误,它说
否则,请参阅
http://lists.w3.org/Archives/Public/www-validator/2013Mar/0009.html
验证器的不稳定开发版本,
http:// qa-dev。 w3.org:8888/ 已修复此错误(并且您的文档
已在其中验证)。

That's right, in HTML5. It's a bug in the validator that it says otherwise, see http://lists.w3.org/Archives/Public/www-validator/2013Mar/0009.html. The unstable development version of the validator, http://qa-dev.w3.org:8888/ has this bug fixed (and your document validates in it).

这可能部分反映了HTML5验证器的性质为
实验软件,它检查某些规格,其中
未在公开场合识别,并且可能随时更改
,恕不另行通知。 - 来源

This may, in part, reflect the nature of HTML5 validator as experimental software that checks against some "specification" which is not identified in public and which may change at any moment without notice and often does. - Source.

注意 - 上面的摘录没有改变,但不是'完整的问题/答案,只是片段。建议任何未来的读者看到链接到此答案顶部的线程,以获取完整的问题+解释为什么会出现这种情况。

Note - The excerpts above haven't been changed, but aren't the full question/answer, merely snippets. Any future readers are advised to see the thread linked to at the top of this answer for the full question + explanation of why this behaviour occurs.

这篇关于URL中的HTML5模糊&符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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