HTMLBuilder and <A HREF='script.py?foo=bar&ding=bats'>yeah teah</A>

Steve Holden sholden at bellatlantic.net
Thu Mar 9 09:53:01 EST 2000


Adrian Eyre wrote:
> 
> > b.startElement ('a', {'href': 'script.py?foo=bar&ding=bats'})
> >
> > [snip]
> >
> > <HTML><A HREF="script.py?foo=bar&ding=bats">Press me</A></HTML>
> >
> > note the '&' in the href argument.
> 
> Indeed. It's substituted for the ampersand, being illegal in an HTML
> document.
> 
> > How can I do this properly?
> 
> What do you mean by properly?
> 
> -----------------------------------------------------------------
> Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com

I suspect that Ben's "properly" in this context means he wants the URL to
be transmitted with the ampersand included as a delimiter between CGI
arguments.  It's perfectly legal HTML to include the ampersand in an
HREF attribute value: that's why URL encoding (%XX, + for space, etc.)
is used: so the receiving entity can distinguish between a literal
ampersand (which would be URL encoded, NOT encoded as an HTML entity)
and an argument separator.

regards
 Steve
--
"If computing ever stops being fun, I'll stop doing it"



More information about the Python-list mailing list