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>
Message-ID: <AKEFJJCOCMAIHGAJJJODKEECCGAA.rwaki@whizbang.com>
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:

    http://lists.w3.org/Archives/Public/html-tidy/2001JanMar/0196.html

Randy
Received on Thursday, 17 May 2001 20:34:43 GMT

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