W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

Re: TIDY doesn't handle asp scripts correctly...instead it misinterprets them

From: Sebastian Lange <lange@cyperfection.de>
Date: Tue, 22 Aug 2000 16:18:31 +0200
Message-Id: <4.3.2.7.2.20000822160857.01a9c6c0@pop3.cyperfection.de>
To: html-tidy@w3.org
The reason why Tidy complains about unescaped ampersand signs in HREFs is 
simply because they are not "legal" HTML, according to the DTD.

Just type the example below into the textarea on 
http://www.htmlhelp.com/tools/validator/direct.html and press the "Validate 
it!" button.

You'll get a result like this:

>Errors
>
>     Line 10, character 54:
>     ... ww.bogus.com/script.asp?p1=1&p2=2&p3=3">..</a>
>                                      ^
>     Error: unknown entity p2
>
>     Line 10, character 59:
>     ... gus.com/script.asp?p1=1&p2=2&p3=3">..</a>
>                                      ^
>     Error: unknown entity p3

You should not change all your hrefs because of Tidy, you should change all 
your hrefs because they are invalid HTML.
The argument "everyone did it false ever since, why should I do it right 
now" is simply answered by "right is right and false is false".


sebastian.


At 23:38 21.08.2000 -0400, Andreas Eibach wrote:


> > > As it turns out, this was *not* what I meant.
> > >
> > > I think it hasn't anything to do with my problem.
>
> > >
> > > Mine is that a site URL inside the HTML
> > >  <a href="http://www.bogus.com/script.asp?p1=1&p2=2&p3=3>
> > >
> > > results in a warning message
> > >
> > > line 1 column xx - Warning: unescaped & or unknown entity "&p2"
> > > line 2 column yy - Warning: unescaped & or unknown entity "&p3"
> > > The thing the thread far below is talking about is a different thing.
>
> > Sorry for not being clearer.
> >
> > Strictly speaking (which we do when it comes to Tidy's output :)), if
> > you want an ampersand character in an attribute such as href, you are
> > supposed to write it as &amp; and not just &.  Writing ampersands this
> > way is known as "escaping" the ampersand, hence Tidy's warning about an
> > unescaped &.
> >
> > Tidy is saying that either a) you have an unescaped ampersand, which is
> > true in your case, or b) you have an unknown entity named p2, which is
> > not true in your case.  Tidy doesn't know which possibility is true, so
> > it lists them both.)
> >
> > Browsers, on the other hand, are lax.  They let you write either &amp;
> > or & to get an ampersand character.  However, without getting into a lot
> > of detail, there are some potentially confusing cases where a plain &
> > doesn't work as expected, so it's just as well that HTML has outlawed
> > it.
> >
> > So Tidy is simply converting each unescaped & into &amp;
> >
> > Before Tidy (illegal href attribute):
> >
>[1]    <a href="http://www.bogus.com/script.asp?p1=1&p2=2&p3=3">
> >
> > After Tidy (legal href attribute):
> >
>[2]  <a href="http://www.bogus.com/script.asp?p1=1&amp;p2=2&amp;p3=3">
> >
>
>So I plead for Tidy to NOT bug with the ampersands in hrefs anyway!
>I also dare to state that [1] is the normal way you see these hrefs in HTML
>documents, [2] is *very* seldom seen imho.
>
>I'm pushy, I know, but I don't have the will to change all my hrefs in my
>pages just because Tidy can't be taught to leave these href's alone.
>So I will live with that.
>Everyone did it this way ever since, why should I change this?
>
>I'm willing to use   &_a_m_p_;   (note strange format because I want to
>prevent it from being converted) if I want to use ampersands in *texts* -
>that's normal behavior. But no one would ever convince me to change all
>ampersands in my asp calls to the above. This would be too much work -
>resulting in nothing but satisfaction that Tidy doesn't output warnings
>anymore.
>But I won't go so far for this 'satisfaction'.
>
>Andreas

--
Sebastian Lange
http://www.sl-chat.de/
Maybe the first chat site that validates as HTML
4.0 even though user input may contain HTML codes.

Courtesy to Dave Raggett's HTML Tidy:
http://www.w3.org/People/Raggett/tidy/

Tidy your documents ONLINE:
http://www.sl-chat.de/Tidy/
Received on Tuesday, 22 August 2000 10:21:32 GMT

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