HTML5验证错误:a href(NFC)

3
我掩盖了以下URL中的所有特殊字符,但w3c-validator仍然报错。 我查看了所有NFC教程,但是我不知道错误在哪里。有任何想法吗? URL
<a href="http://www.example.de/index.php&#63;cnid&#61;efcb9a458fb823ba877ef53b7162598f&#38;ldtype&#61;grid&#38;cl&#61;alist&#38;tpl&#61;&#38;fnc&#61;executefilter&#38;fname&#61;&#38;attrfilter&#91;3a5d1ca314a5205fa7b7b3baa5d2f94e&#93;&#91;2f143d22ce421269b5c7d01a160f6541&#93;&#61;2f143d22ce421269b5c7d01a160f6541">Asche</a>

w3c-错误

Line 618, Column 441: Bad value http://www.example.de/index.php?cnid=efcb9a458fb823ba877ef53b7162598f&ldtype=grid&cl=alist&tpl=&fnc=executefilter&fname=&attrfilter[3a5d1ca314a5205fa7b7b3baa5d2f94e][2f143d22ce421269b5c7d01a160f6541]=2f143d22ce421269b5c7d01a160f6541 for attribute href on element a: Illegal character in query component.

…21269b5c7d01a160f6541&#93;&#61;2f143d22ce421269b5c7d01a160f6541">Asche</a></li>

IRI引用的语法

Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 
1个回答

3
URL中的字符[]需要进行百分号编码,分别为%5B%5D,根据STD 66(附录A包含语法概要,显示括号是“gen-delims”字符,在查询部分中不允许出现,除非作为百分号编码)。您应该发布一个HTML文档,因为这是验证器的工作内容。以下测试文档(经过验证)包含您提到的URL,已正确编码:
<!doctype html>
<meta charset=utf-8>
<title></title>
<a href=
"http://www.example.de/index.php?cnid=efcb9a458fb823ba877ef53b7162598f&amp;ldtype=grid&amp;cl=alist&amp;tpl=&amp;fnc=executefilter&amp;fname=&amp;attrfilter%5B3a5d1ca314a5205fa7b7b3baa5d2f94e%5D%5B2f143d22ce421269b5c7d01a160f6541%5D=2f143d22ce421269b5c7d01a160f6541">foo</a>

除此之外,URL无法工作;它会导致“多种选择”响应,这非常奇怪(当服务器进行某些内容协商但找不到可接受的替代方案时应发出此类消息,并呈现一组替代方案;但在这里,它更像是“未找到”情况)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接