Skip to main content.
home | support | download

Back to List Archive

Re: Ampersands are being converted

From: Bill Moseley <moseley(at)>
Date: Tue Sep 21 2004 - 13:49:37 GMT
On Tue, Sep 21, 2004 at 08:58:18AM -0400, Terry Gliedt wrote:
> I was surprised at &amp;.  I had expected to see & instead of &amp;. 
> The char entity isn't needed of course, since the href value is not 
> rendered visible in the page.

No, that's not really correct.  Your browser is just being nice and
allowing the naked ampersand.  It's suppose to be there -- you have
been writing invalid (unvalidated) hrefs for years. ;)

Consider this url which selects which amplifier to use to play your
music on your home media network and how many times to repeat it:


You can see that &amp and &copy are a bit confusing.  Those equal
signs after &amp and &copy, in general, terminate the entity without
the need for the explicit semicolon.

Don't believe me?  Drop this into your web server and click on the

#!/usr/bin/perl -w
use strict;

my $query = $ENV{QUERY_STRING} || "blank";

print <<EOF
Content-type: text/html

<html><head><title>Test &amp; in hrefs</title></head>
Current passed query string = [$query]
<a href="$ENV{SCRIPT_NAME}?volume=39&amp=2&copy=2&name=whitewedding">play</a>

Try running that through an HTML validator.

> See the 'Next 15' link. It contains 'use=fusion', but the other links to 
> pages do not. So when I click on '2', the link fails because swish.cgi 
> is looking for the default datebase (default.index). But the script did 
> know enough to specify the use= keyword for 'Next 15'.

Where does that "use" parameter come from?  It's not how swish.cgi
selects different index files (with the "select_indexes" feature) if
that's what you mean by "database" above.

Bill Moseley

Unsubscribe from or help with the swish-e list:

Help with Swish-e:
Received on Tue Sep 21 06:50:15 2004