user2044658
user2044658

Reputation: 31

HTML5 validation error a href (NFC)

I masked all special characters in the following URL, but w3c-validator still throws error. I checked all the NFC Tutorials but I have no idea where is the error. Any idea ?

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-Error

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>

Syntax of IRI reference

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

Upvotes: 3

Views: 2534

Answers (1)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201538

The characters [ and ] need to be %-encoded in a URL, as %5B and %5D, according STD 66 (where Appendix A contains a syntax summary, showing that the brackets are “gen-delims” characters, which are not allowed in a query part except as %-encoded).

You should have posted an HTML document, since that’s what validators work on. The following test document (which validates) contains the URL you mention, properly encoded:

<!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>

Quite apart from this, the URL does not work; it causes a “Multiple Choices” response, which is rather odd (such a message should be issued when the server is doing some content negotiation that does not find an acceptable alternative, and a list of alternatives should be presented; but here it’s more or less a “Not Found” situation).

Upvotes: 3

Related Questions