cgi.py and HTML 4.0 compliancy

Ben Hutchings ben.hutchings at roundpoint.com
Tue Feb 6 17:10:07 EST 2001


Mark Pilgrim <f8dy at my-deja.com> writes:

> In article <3A801BC6.6ED77FEA at stroeder.com>,
>   Michael =?iso-8859-1?Q?Str=F6der?= <michael at stroeder.com> wrote:
> > Juergen wrote:
> > >
> > > according to "validator.w3.org" the following URL is not HTML 4
> > > compliant:
> > >    <a href="mycgiscript.py?
> firstParam=Bill&secondParam=Whitters">Some
> > > Text</a>
> 
> Technically, this is not a valid URL.

It's a valid URL, but the value of the HREF attribute is interpreted
as PCDATA, i.e. ampersands within it introduce entities.

> The "&" must be written as "&".

Right.

<snip>
> This is not true; URLs can contain parameters, as long as they are
> properly URL-encoded.

No, this is not URL-encoding.  URL-encoding (which is what Michael was
trying, replacing '&' with '%26') is a way of escaping characters that
are outside the range of legal characters for URLs or have special
meaning in URL syntax.  Since the '&' here is *meant* to have special
meaning as a query parameter separator, it must not be escaped.

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list