Re: HTML interpretation of ampersands

Garrett Arch Blythe (doslynx@falcon.cc.ukans.edu)
Tue, 12 Jul 1994 12:54:10 -0500 (CDT)


On Tue, 12 Jul 1994, Bennet-Tec Support wrote:

> ------------------
>
> To: Anyone who can help.
>
> From: Jeff Bennett
>
> Re: HTML Specification: Interpretation of Ampersands
>
>
> I am writing an interpreter for HTML using Visual Basic and the ALLText custom
> control for display of multi-font text and hypertext handling.
>
> I am somewhat confused by the use of the ampersand character ("&"). As far as I
> read the specification, the ampersand is to be used ONLY as a special escape
> character. In order to embed an ampersand in the text presented by a viewer one
> should use the string "&amp". My confusion arises from the fact that I have a
> copy of MOSAIC which appears to handle the ampersand in some cases as a standard
> character. For instance, in the following line of a HTML document:
>
> <li><a href="uh00coay.htm"><h2>P&G did something weird </h2></a>
>
> Is there some special case in force here? How should a string like this be
> handled?
>
> What should the rule for interpretation be where the ampersand is not followed
> by either a character reference or one of the special entities specified in the
> DTD?

In such cases where the '&' doesn't map to a DTD entity, then the parser
usually just goes ahead and displays the '&' and the text following.

Not to say that this is correct.

In Lynx, but not some Mosaics, take for example the following which is not
correctly parsed:

<a href=someURL>Some Text &</a>

will display

Some Text &</a>

It will work with a space in between the '&' and '</a>'.

Garrett.

Trodden Soil

I am trodden soil.
Dust covers my face.
Soles crush my nature
Revealing a hard empty space.

Garrett Arch Blythe (913)864-0436
User Services Student Programmer/Consultant
University of Kansas Computer Center
<doslynx@falcon.cc.ukans.edu>