W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2002

FAQ: Tidy breaks my URIs by converting ampersands to &

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sun, 31 Mar 2002 18:55:30 +0200
To: html-tidy@w3.org
Message-ID: <oteeauopfrjq4q6rht09d7l6s9n0ddr9c6@4ax.com>
Unescaped ampersands are illegal most of the time in HTML and XHTML and
user agents treat them differently. Tidy tries a best guess on what you
really wanted to write and escapes the ampersands accordingly. For
example,

  ... href="http://www.example.org/script?x=1&y=2"

will become

  ... href="http://www.example.org/script?x=1&amp;y=2"

Tidy does not change your URI, it changes the (X)HTML representation of
it. While your script might stop working if you pass the URI including
the &amp; directly, the link will still work, since user agents will
unescape the &amp; and request the right thing. Tidy doesn't break
anything here, it corrects your possible error and increases stability
of your document. This is not a bug. However, *if you /really/ want to
change this behaivour* you may use the `--QuoteAmpersand no`
configuration option to prevent proper escaping of ampersands, but don't
do this for reasons of validity and [potential problems this might
cause] (http://ppewww.ph.gla.ac.uk/~flavell/www/formgetbyurl.html).
Please also take a look at [Appendix B.2.2 of the HTML 4.01
recommendation] (http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2)
discussing the same issue.
Received on Sunday, 31 March 2002 11:56:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:51 GMT