473,549 Members | 5,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ampersands in urls (get)


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=532 7311&siteid=406 67184
&bfpage=storeti le11" 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
5 2786


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=532 7311&siteid=406 67184
&bfpage=storeti le11" 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
On Tue, 10 Feb 2004 07:41:29 -0600, kaeli
<ti******@NOSPA M.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
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
In article <Pi************ *************** ***@ppepc56.ph. gla.ac.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
Tim
On Tue, 10 Feb 2004 07:41:29 -0600,
kaeli <ti******@NOSPA M.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=532 7311&siteid=406 67184
&bfpage=storeti le11" 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2582
by: leegold2 | last post by:
The subject title is a sedgeway into my question that may slightly of topic but I've asked many sources and don't have an answer yet so I ask it here. I have a text fields of html marked up content which I render via php. Looking at the rendered html page in a text editor I see that ampersands all appear as &amp; When I select the field via...
2
4980
by: micha | last post by:
my php script gets delivered text that contains special chars (like german umlauts), and these chars may, may partially or may not be coverted into html entities already. i don't know beforhand. question: how to spot wether an ampersand is just an ampersand and needs to be converted or is part of an html entity and must be left alone? ...
1
1792
by: jjbutera | last post by:
How do I escape these? The backslash doesn't seem to be working.
5
6478
by: AJ Brown | last post by:
How does one allow the use of ampersands (or other special characters for that matter) within Element text and Attribute text? I have problems using LoadXml from a string "<text value="Jack & Jill"/>" into an XmlDocument. I can't for the life of me find a switch that turns off this feature of the parser. -AJ
4
2115
by: MLH | last post by:
I have tried the following in the immediate window. It yields an error... ?"Hello"&vbCrLf&"there"&vbCrLf&"next"&vbCrLf&"line." 'Type declaration character does not match declared data type. But the following does works as expected... ?"Hello" & vbCrLf & "there" & vbCrLf & "next" & vbCrLf & "line."
10
4895
by: jflash | last post by:
Hello all, I feel dumb having to ask this question in the first place, but I just can not figure it out. I am wanting to set my site up using dynamic urls (I'm assuming that's what they're called, an example of what I have in mind is index.php?page=). However, I can not figure out how to do this. I will eventually want to use SEF urls, but...
3
3857
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess which redirect you to normal URLs with GET parameters
7
2941
by: Gene Kelley | last post by:
I'm having some trouble echoing string data that contains an ampersand in it. I am filling a WHERE clause in my SQL query with a string based upon a choice made in a select/option form element via GET. My request for http://www.example.com/update_company.php?company=Bill%20&%20John's%20Critter%20Control%20Company returns only Bill
11
8919
by: Steven D'Aprano | last post by:
I'm using urllib.urlretrieve() to download HTML pages, and I've hit a snag with URLs containing ampersands: http://www.example.com/parrot.php?x=1&y=2 Somewhere in the process, urls like the above are escaped to: http://www.example.com/parrot.php?x=1&amp;y=2 which naturally fails to exist.
0
7455
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7723
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7480
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5373
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5092
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3504
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.