Ampersands in hyperlinks cause W3C validation to fail

前端 未结 4 1879
-上瘾入骨i
-上瘾入骨i 2021-01-21 04:19

I have a reacurring problem. I code nice standards compliant code only to have it fail due to ampersands within some of the hyperlink urls.

Does anyone know of a work ar

4条回答
  •  灰色年华
    2021-01-21 05:09

    You should URL Encode the hyperlinks, so all characters are turned into a valid ASCII format and don't contain any (X)HTML entities.

    For C# use HttpUtility.UrlEncode, for PHP urlencode, for JavaScript encodeURI, etc... Finding the right method for the language you're using shouldn't be that hard.

提交回复
热议问题