Tidy 3

From Htmlpedia
Jump to: navigation, search

Tidy: unescaped & or unknown entity "&..."

Cause 1:

An ampersand was used on its own where the entity "&" should have been used, causing web browsers to think you were referring to an entity beginning with whatever letters comes after the lone "&".

Example:

Very often this is due to a link defined like this:

Bad<a href="http://www.example.com/cgi?x=123&y=456">
Good<a href="http://www.example.com/cgi?x=123&amp;y=456">

All special characters in HREF should be encoded. "&" is a reserved character that begins an entity. (ex: &nbsp;). "&" in an HREF field should be encoded as its equivalent entity "&amp;", even when used as a separator for parameters in the URL. Before you make an opinion about this, please read this page carefully.

Solution:

Replace "&" with "&amp;".

References:

Cause 2:

You misspelled the name of a character entity (a string beginning with "&").

Example:

Bad&Arin;rhus University
Good&Aring;rhus University

Solution:

Fix the spelling to match one of the names listed in Chapter 24 of the HTML 4 specification.

References:

Cause 3:

(Error message is Tidy: unescaped & or unknown entity "&#...", where ... are digits or "x" followed by hex digits).

Tidy does not always recognize valid numeric character entities.

This is a bug in Tidy and should be ignored.

Example:

This incorrect error occurs in cases such as the following, all 3 examples are correct HTML, tidy is just wrong:

BadJust my &#8364;0.02 (2 Eurocents)
BadJust my &#x20AC;0.02 (2 Eurocents)
GoodJust my $0.02 (2 dollar-cents)

Solution:

Ignore the error message and hope someone fixes the bug in HTML tidy.

References: