Tidy 64

From Htmlpedia
Jump to: navigation, search

Contents

Tidy: “<> escaping malformed URI reference”

Cause:

A URI contains impermissible characters or quotes around the URI are not closed.

Example:

Bad<a href="http://www.mozilla.org/one space.html">space</a>
Good<a href="http://www.mozilla.org/one%20space.html">space</a>
Good<a href="http://www.mozilla.org/one+space.html">space</a>
Bad<a href="http://www.site.com/déjà.htm">déjà</a>
Good<a href="http://www.site.com/d%E9j%E0.htm">d&eacute;j&agrave;</a>
Bad<a href="http://www.w3.org/>W3C</a>
Good<a href="http://www.w3.org/">W3C</a>
Bad<a href="mailto:name@domain.com?subject=one space">Email me!</a>
Good<a href="mailto:name@domain.com?subject=one%20space">Email me!</a>

A space should not be contained in a URI (even if it works in all browsers…). This is detailed in RFC1738; look for the word “unsafe”.

Solution:

  • If the URI contains impermissible characters, replace the characters with permissible ones or encode them using hexadecimal format. In the case of URIs, hexadecimal format uses a percentage character followed by a combination of two letters and digits (a-f and 0-9). The notation for the space character is %20.
  • If the URI is missing a quotation mark delimiter, add the character.

References:

Personal tools