Page is a not externally linkable
- Code, Content, and Presentation
-- HTML
---- Should I encode ampersands in my canonical tags?


swa66 - 12:36 am on Feb 23, 2013 (gmt 0)


In all html (also in xhtml5) except for HTML5 you *have* to encode a content &.
Standards ...

HTML5 allows the author to write worse code than it needs to allow. So you can get away with it in that standard provided the characters following the & do not look like an htmlentity - and since HTML5 is now a "living" standard: you do not know what html entities they will invent in the future. So you cannot guarantee that in the future it will not start to "look like" an htmlentity.

A useless thing for lazy authors IMHO. - But HTML5 is stuffed with that kind of thing.

So not encoding every content & in an html document as &amp; is a mistake IMHO - of equal proportion to using < or > in the content that's not encoded as &lt; or &gt; .

Regardless of standards, browsers can recover from the error in many cases but let's assume you write:
<a href="http://www.example.com/file?a=1&copy=2">
It's an error, but which did you intend
<a href="http://www.example.com/file?a=1&copy;=2"> (insert a copyright sign, that's missing the semicolon ?)
or
<a href="http://www.example.com/file?a=1&amp;copy=2"> (an unescaped ampersand?)

Validators hopefully will continue to flag it as errors.


Thread source:: http://www.webmasterworld.com/html/4547916.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com