W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2001

RE: Unexpected behaviour

From: Randy Waki <rwaki@flipdog.com>
Date: Thu, 17 May 2001 18:34:05 -0600
To: <html-tidy@w3.org>
I don't want to turn this into a bigger deal than it needs to be, but
it turns out I spent some time investigating Tidy's replacement of "&"
with "&amp;" a few months ago.  Many of the points have been mentioned
by others in this thread.

  - The HTML, XML, and XHTML specs all require "&" to be written as
    "&amp;".  This is because "&" can be ambiguous while "&amp;" is not.

  - Most (all?) browsers do NOT require "&" to be written as "&amp;".
    This is because they employ heuristics to resolve an ambiguous "&".
    These heuristics usually work but they introduce inconsistencies,
    which is probably why the specs didn't use them.  Most (all?)
    browsers also accept the unambiguous "&amp;".  This is entirely
    about disambiguating the markup syntax.  Users and web servers
    should not see "&amp;" in URLs.

  - Tidy's job is to clean up HTML to conform with the specs while
    preserving what users experience in their browsers.  So Tidy
    replaces the illegal "&" with the legal "&amp;", employing the same
    heuristics as browsers to resolve any ambiguities.  Again, users and
    web servers should not see a difference.  Only people who look at
    the markup can tell.

  - Still, some people who look at the markup, for their own reasons
    good or bad, want to see "&" even if it is illegal and possibly
    ambiguous.  For those people, Tidy has a quote-ampersand=no option
    that disables the "&" replacement.

  - The current 4 August 2000 Tidy has a bug that occasionally causes it
    to botch the "&" replacement.  I submitted a patch a few months ago:


Received on Thursday, 17 May 2001 20:34:43 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:50 UTC