简体   繁体   English

W3C标记验证符&符错误

[英]w3c markup validator ampersand (&) error

Is there any workaround for the w3c validation error for an & present in urls or some other place in HTML markup? 在URL或HTML标记中的其他地方是否存在针对&的w3c验证错误的解决方法?
It says: 它说:

& did not start a character reference. &未启动字符引用。 (& probably should have been escaped as & .) (&可能应该以&来转义。)

The ampersand in my case is a part of a url for gravatar thumbnail. 在我的情况下,“&”号是gravatar缩略图的网址的一部分。 This is the problematic part of a url: 这是网址的问题部分:

c91588793296e2?s=50&d=http%3A%2F% . c91588793296e2?s=50&d=http%3A%2F%

Use & 使用& for literal ampersands, even in URLs. 甚至在URL中也使用文字“&”号。

http://htmlhelp.com/tools/validator/problems.html#amp http://htmlhelp.com/tools/validator/problems.html#amp

for each & sign you got write & 对于每个&符号,您都会写& in your example it would be: 在您的示例中,它将是:

c91588793296e2?s=50&d=http%3A%2F%

替换为&

should be: 应该:

c91588793296e2?s=50&d=http%3A%2F%.

notice the & 注意&

I know it feels wonky, but ampersands have to be encoded as html entities, which are confusingly denoted with ampersands. 我知道它感觉很古怪,但是必须将&符号编码为html实体,并用&符号混淆地表示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM