Tidy 61

From Htmlpedia
Jump to: navigation, search

Tidy: URI reference contains backslash. Typo?


There is a backslash in a URI.

Although backslashes are acceptable in theory within URLs, in practice they are usually due to following the Windows custom of using backslashes as path separators instead of using forward slashes (the accepted path separator in a URI), or the Unix custom of escaping special characters by backslashes, instead of using percent-escaping (the accepted URI format).


Bad<img src="http:\\www.example.com\some\path\foobar.jpg">
Good<img src="http://www.example.com/some/path/foobar.jpg">
Bad<a href="http://www.example.com/some/file with back\slash.html">
Good<a href="http://www.example.com/some/file%20with%20back%5Cslash.html">
Bad<a href="http://www.example.com/path\ with\ spaces\ and\ \"quotes\".html">
Good<a href="http://www.example.com/path%20with%20spaces%20and%20%22quotes%22.html">
Good<a href="http://www.example.org/Trade%20marks%C2%AE%20and%20%C2%A9%20Copyrights.html">


  • Make sure that only forward slashes are used as path separators in URIs
  • Special characters (normally not accepted in a URI) can be represented by their hex value preceded by a percent sign
  • As shown in the (somewhat contrived) last example above, for characters above 127 the UTF-8 representation is percent-escaped one byte at a time.