By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,613 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,613 IT Pros & Developers. It's quick & easy.

ampersands in urls (get)

P: n/a

Hey all,

In trying to get my site to validate (html 4.01 transitional), I ran
across an issue with this type of url in an href:
http://www.server.com/somePage?param1=1&param2=2 etc

Notably:
Line 49, column 115: cannot generate system identifier for general
entity "siteid"

....bfast.com/bfast/serve?bfmid=5327311&siteid=40667184
&bfpage=storetile11" BORD
Now, I've never had a problem with hrefs of that sort (that is, when I
click on them, they take me to the page as expected in all browsers I've
tested with). I assume this is invalid markup since the validator
bitched about it, and I assume the correction would be to put & in
there instead, but as this code was generated by an affiliate program, I
want to be sure it won't mess anything up before I change it.
So, does changing the ampersands in a get-type url into & screw
things up for the server when it tries to parse that? It's not my server
(it's petsmart, actually), so I can't test to see.

--
--
~kaeli~
With her marriage, she got a new name and a dress.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a


kaeli wrote:

In trying to get my site to validate (html 4.01 transitional), I ran
across an issue with this type of url in an href:
http://www.server.com/somePage?param1=1&param2=2 etc

Notably:
Line 49, column 115: cannot generate system identifier for general
entity "siteid"

....bfast.com/bfast/serve?bfmid=5327311&siteid=40667184
&bfpage=storetile11" BORD
Now, I've never had a problem with hrefs of that sort (that is, when I
click on them, they take me to the page as expected in all browsers I've
tested with). I assume this is invalid markup since the validator
bitched about it, and I assume the correction would be to put & in
there instead, but as this code was generated by an affiliate program, I
want to be sure it won't mess anything up before I change it.
So, does changing the ampersands in a get-type url into & screw
things up for the server when it tries to parse that? It's not my server
(it's petsmart, actually), so I can't test to see.


The W3C validator also offers some help on this
http://validator.w3.org/docs/errors.html#bad-entity
and that clearly states that the user agent will convert the & to
the character & before passing a URL to a server so there shouldn't be
any problems with the server

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
On Tue, 10 Feb 2004 07:41:29 -0600, kaeli
<ti******@NOSPAM.comcast.net> wrote:
...I ran across an issue with this type of url in an href:
http://www.server.com/somePage?param1=1&param2=2 etc ...I assume the correction would be to put &amp; in there
Yes.
...does changing the ampersands in a get-type url into &amp;
screw things up for the server...


No.

Anywhere in HTML markup where you want to place an ampersand directly
followed by a valid NAMESTART character, you shall use the &amp;
entity reference. If you don't, a validating SGML parser will think
that you are referencing another entity, like the nonexistent &siteid
in your case.

--
Rex
Jul 20 '05 #3

P: n/a
On Tue, 10 Feb 2004, Martin Honnen wrote:
kaeli wrote:
but as this code was generated by an affiliate program, I
want to be sure it won't mess anything up before I change it.
Well, if the affiliate program mandates that you put invalid syntax
into your web pages (as many of them do), you'd have every right to
complain loudly, and point them to the relevant specifications. But
if you want the money, or whatever other benefits they give, I guess
you have to follow their instructions to the letter, unfortunately.
So, does changing the ampersands in a get-type url into &amp; screw
things up for the server


The server never gets to see it. Not with a properly-implemented
browser, anyway (the last one which I saw getting it wrong was some 5
years back). In my web page[1] I do show some examples of what can go
wrong if you _don't_ follow the spec.
The W3C validator also offers some help on this
http://validator.w3.org/docs/errors.html#bad-entity
and that clearly states that the user agent will convert the &amp; to
the character & before passing a URL to a server so there shouldn't be
any problems with the server


Yes indeed; however, the HTML recommendations from RFC1866/HTML2.0
onwards have offered a better solution: server scripts should be
implemented to recognise both the ampersand (which is inevitably
produced when a form is submitted) _and_ some alternative delimiter -
it suggests semicolon - which causes less fuss for such "composed"
URLs.

hope this helps

[1] http://ppewww.ph.gla.ac.uk/~flavell/...mgetbyurl.html

Jul 20 '05 #4

P: n/a
In article <Pi******************************@ppepc56.ph.gla.a c.uk>,
fl*****@ph.gla.ac.uk enlightened us with...

The server never gets to see it. Not with a properly-implemented
browser, anyway (the last one which I saw getting it wrong was some 5
years back). In my web page[1] I do show some examples of what can go
wrong if you _don't_ follow the spec.
The W3C validator also offers some help on this
http://validator.w3.org/docs/errors.html#bad-entity

Thanks everyone!

--
--
~kaeli~
A chicken crossing the road is poultry in motion.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #5

P: n/a
Tim
On Tue, 10 Feb 2004 07:41:29 -0600,
kaeli <ti******@NOSPAM.comcast.net> wrote:
In trying to get my site to validate (html 4.01 transitional), I ran
across an issue with this type of url in an href:
http://www.server.com/somePage?param1=1&param2=2 etc

Notably:
Line 49, column 115: cannot generate system identifier for general
entity "siteid"

....bfast.com/bfast/serve?bfmid=5327311&siteid=40667184
&bfpage=storetile11" BORD
Now, I've never had a problem with hrefs of that sort (that is, when I
click on them, they take me to the page as expected in all browsers I've
tested with).
That's because many browsers will make a guess, or just work
incorrectly. You won't notice many of the errors in webpages, though
that doesn't mean that everyone else will be so lucky.
I assume this is invalid markup since the validator
bitched about it, and I assume the correction would be to put &amp; in
there instead,
Yes. That satisfies the conditions for how you write ampersands within
an HTML document, and the browser requests the right URI when you use
the reference.
but as this code was generated by an affiliate program, I
want to be sure it won't mess anything up before I change it.
So, does changing the ampersands in a get-type url into &amp; screw
things up for the server when it tries to parse that? It's not my server
(it's petsmart, actually), so I can't test to see.


No it doesn't, the browser requests the URI as you've stated it, it's
okay as an URI, it's just that you can't write it that way in HTML. The
browser takes care of transcoding it for you (your &amp; tells it what
to do, and it does it; it requests the URI with it as &).

If the affiliate program is stupid, they might complain about you
changing (correcting) such things. The chances are, though, that all
they care is that you provide the right information (the end result must
be what they're expecting).

--
My "from" address is totally fake. The reply-to address is real, but
may be only temporary. Reply to usenet postings in the same place as
you read the message you're replying to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.