Ampersand encoding in img src
I am trying to display an image (gravatar), but the ampersand in its link
seem to be problematic.
At first, I had:
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>& in url</title>
</head>
<body>
<a
href="http://www.gravatar.com/avatar/f14e8ce12e7d7ffc11fe8a29127030da.jpg?d=mm&r=r">Link
to image</a>
<img
src="http://www.gravatar.com/avatar/f14e8ce12e7d7ffc11fe8a29127030da.jpg?d=mm&r=r"
alt="display image">
</body>
</html>
The link (<a>) works fine this way, but the image (<img>) won't show. And
of course it doesn't pass the w3c validation.
I encoded the ampersand to &, but the result stays the same (except
for the w3c validation which is OK). I even tried a urlencoded version
(via PHP) with no luck.
Any idea on what I am missing?
No comments:
Post a Comment