473,554 Members | 4,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ampersand in urls when using xhtml 1.0 strict

When I write a url in xhtml, with an unencoded ampersand, like this:

http://localhost:2063/Client/ViewRep...8&Type=SUMMARY

the xhtml sytax checker correctly indicates an error, telling me that
it should be:

http://localhost:2063/Client/ViewRep...p;Type=SUMMARY

see: <http://www.htmlhelp.co m/tools/validator/problems.html#a mp>

However the last sentence there ends:

"the browser translates "&amp;" to "&" so the Web server would only
see "&" and not "&amp;" in the query string of the request."

My web server is clearly seeing &amp; and the browser (FF 1.0.0.11) is
also showing &amp; in the url.

I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

with no xml prefix because, as we all know, IE6 breaks when the xml
prefix is present.

What is the cause and solution of this problem.

I am using FF 1.0.0.11, via a local asp.net 2.0 site through the mini
webserver (Cassini) on WinXP SP2 with all latest o/s updates installed
(apart from IE7, I am using IE6 on this PC).

Do I have to apply a url decode algorithm when the web page loads?
That is far from ideal because the problem here is that the browser is
not showing the decoded url.

Is this a bug in FF?

Finally is there a DOCTYPE I can use to force all the 5 major browsers:
IE6, IE7, FF, Opera, Safari to all render in strict mode when
displaying xhtml?
Dec 17 '07 #1
13 5340
mark4asp wrote:
When I write a url in xhtml, with an unencoded ampersand, like this:

http://localhost:2063/Client/ViewRep...8&Type=SUMMARY

the xhtml sytax checker correctly indicates an error, telling me that
it should be:

http://localhost:2063/Client/ViewRep...p;Type=SUMMARY

see: <http://www.htmlhelp.co m/tools/validator/problems.html#a mp>

However the last sentence there ends:

"the browser translates "&amp;" to "&" so the Web server would only
see "&" and not "&amp;" in the query string of the request."

My web server is clearly seeing &amp; and the browser (FF 1.0.0.11) is
also showing &amp; in the url.

I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

with no xml prefix because, as we all know, IE6 breaks when the xml
prefix is present.

What is the cause and solution of this problem.

I am using FF 1.0.0.11, via a local asp.net 2.0 site through the mini
webserver (Cassini) on WinXP SP2 with all latest o/s updates installed
(apart from IE7, I am using IE6 on this PC).
You're using 1.0.0.11? The bug is that it's practically the very first
version released and it was superseded by 1.0.1 within a couple of
months, by 1.5 over two years ago, and by 2.0 over a year ago. Based on
usage of the high-traffic site I'm involved with, virtually no one is
using Firefox 1.x any more (probably because Firefox prompts you to
update it), and you *certainly* shouldn't be doing anything with a
version that has been outdated over ten times as long as the product had
existed when the version was replaced.
>
Do I have to apply a url decode algorithm when the web page loads?
That is far from ideal because the problem here is that the browser is
not showing the decoded url.

Is this a bug in FF?
There is no problem with this whatsoever in Firefox 2, I can tell you
that. Use &amp; in your links and images and so forth and it'll work.
Dec 17 '07 #2
mark4asp wrote:
When I write a url in xhtml, with an unencoded ampersand, like this:

http://localhost:2063/Client/ViewRep...8&Type=SUMMARY

the xhtml sytax checker correctly indicates an error, telling me that
it should be:

http://localhost:2063/Client/ViewRep...p;Type=SUMMARY

see: <http://www.htmlhelp.co m/tools/validator/problems.html#a mp>

However the last sentence there ends:

"the browser translates "&amp;" to "&" so the Web server would only
see "&" and not "&amp;" in the query string of the request."

My web server is clearly seeing &amp; and the browser (FF 1.0.0.11) is
also showing &amp; in the url.

I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

with no xml prefix because, as we all know, IE6 breaks when the xml
prefix is present.

What is the cause and solution of this problem.

I am using FF 1.0.0.11, via a local asp.net 2.0 site through the mini
webserver (Cassini) on WinXP SP2 with all latest o/s updates installed
(apart from IE7, I am using IE6 on this PC).

Do I have to apply a url decode algorithm when the web page loads?
That is far from ideal because the problem here is that the browser is
not showing the decoded url.

Is this a bug in FF?

Finally is there a DOCTYPE I can use to force all the 5 major
browsers: IE6, IE7, FF, Opera, Safari to all render in strict mode
when displaying xhtml?
The immediate problem is now fixed. Somehow the page with the urls was
missing a Content-Type header:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

After including this header I was able to remove the encoded
ampersands, [ &amp; ], to replace them with just a &. The xhtml
syntax checker no longer indicated errors here and the page navigation
now works.
--

Dec 17 '07 #3
..oO(mark4asp)
>The immediate problem is now fixed. Somehow the page with the urls was
missing a Content-Type header:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Surely not. If this "fixed" your problem, then there's something wrong
with your server.
>After including this header I was able to remove the encoded
ampersands, [ &amp; ], to replace them with just a &. The xhtml
syntax checker no longer indicated errors here and the page navigation
now works.
I doubt that. Ampersands in a URL _must_ be encoded.

Micha
Dec 17 '07 #4
mark4asp wrote:
mark4asp wrote:
>When I write a url in xhtml, with an unencoded ampersand, like this:

http://localhost:2063/Client/ViewRep...8&Type=SUMMARY

the xhtml sytax checker correctly indicates an error, telling me that
it should be:

http://localhost:2063/Client/ViewRep...p;Type=SUMMARY

see: <http://www.htmlhelp.co m/tools/validator/problems.html#a mp>

However the last sentence there ends:

"the browser translates "&amp;" to "&" so the Web server would only
see "&" and not "&amp;" in the query string of the request."

My web server is clearly seeing &amp; and the browser (FF 1.0.0.11) is
also showing &amp; in the url.

I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

with no xml prefix because, as we all know, IE6 breaks when the xml
prefix is present.

What is the cause and solution of this problem.

I am using FF 1.0.0.11, via a local asp.net 2.0 site through the mini
webserver (Cassini) on WinXP SP2 with all latest o/s updates installed
(apart from IE7, I am using IE6 on this PC).

Do I have to apply a url decode algorithm when the web page loads?
That is far from ideal because the problem here is that the browser is
not showing the decoded url.

Is this a bug in FF?

Finally is there a DOCTYPE I can use to force all the 5 major
browsers: IE6, IE7, FF, Opera, Safari to all render in strict mode
when displaying xhtml?

The immediate problem is now fixed. Somehow the page with the urls was
missing a Content-Type header:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

After including this header I was able to remove the encoded
ampersands, [ &amp; ], to replace them with just a &. The xhtml
syntax checker no longer indicated errors here and the page navigation
now works.
First, this is very strange because if your browser was displaying the
page as HTML, then it was already receiving a content type header from
the web server (which the web server should always send--the META tag
should only be useful for cases where the server isn't sending a content
type header or when you are opening up a static web page directly on
your system instead of requesting it from a web browser) telling it that
the page was HTML, or else there was no header and the browser was
treating it as HTML by default.

Second, this is very strange because NOT encoding ampersands *is*
invalid and the W3C validator wouldn't start treating it as valid
because you included a META tag that wasn't necessary anyway and that
wouldn't cause the effect that you've stated.
Dec 17 '07 #5
On Mon, 17 Dec 2007, Harlan Messinger wrote:
Second, this is very strange because NOT encoding ampersands *is* invalid
No, it isn't. & and &amp; just mean different things.
See the valid page
http://www.unics.uni-hannover.de/nht...ampersand.html

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell
Dec 17 '07 #6
On Mon, 17 Dec 2007, mark4asp wrote:
Somehow the page with the urls was
missing a Content-Type header:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
No <metais ever missing. No <metais ever required.
Especially <meta http-equivis a poor ersatz for real HTTP header.
http://www.unics.uni-hannover.de/nht...a-http-equiv.1
http://www.unics.uni-hannover.de/nht...a-http-equiv.2

Learn how to configure your web server correctly:
http://www.w3.org/International/O-HTTP-charset

--
Bugs in Internet Explorer 7
http://www.unics.uni-hannover.de/nhtcapri/ie7-bugs
Dec 17 '07 #7
On Mon, 17 Dec 2007, mark4asp wrote:
When I write a url in xhtml, with an unencoded ampersand,
& and &amp; mean different things:
http://www.unics.uni-hannover.de/nht...ampersand.html
http://www.unics.uni-hannover.de/nht...ampersand.text
I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
What for? You can do everything with HTML 4 Strict.

--
Top-posting.
What's the most irritating thing on Usenet?
Dec 17 '07 #8
Harlan Messinger wrote:
mark4asp wrote:
When I write a url in xhtml, with an unencoded ampersand, like this:

http://localhost:2063/Client/ViewRep...8&Type=SUMMARY

the xhtml sytax checker correctly indicates an error, telling me
that it should be:

http://localhost:2063/Client/ViewRep...p;Type=SUMMARY

see: <http://www.htmlhelp.co m/tools/validator/problems.html#a mp>

However the last sentence there ends:

"the browser translates "&amp;" to "&" so the Web server would only
see "&" and not "&amp;" in the query string of the request."

My web server is clearly seeing &amp; and the browser (FF 1.0.0.11)
is also showing &amp; in the url.

I am using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

with no xml prefix because, as we all know, IE6 breaks when the xml
prefix is present.

What is the cause and solution of this problem.

I am using FF 1.0.0.11, via a local asp.net 2.0 site through the
mini webserver (Cassini) on WinXP SP2 with all latest o/s updates
installed (apart from IE7, I am using IE6 on this PC).

You're using 1.0.0.11? The bug is that it's practically the very
first version released and it was superseded by 1.0.1 within a couple
of months, by 1.5 over two years ago, and by 2.0 over a year ago.
Based on usage of the high-traffic site I'm involved with, virtually
no one is using Firefox 1.x any more (probably because Firefox
prompts you to update it), and you certainly shouldn't be doing
anything with a version that has been outdated over ten times as long
as the product had existed when the version was replaced.
Apologies, a typo. I am using FF 2.0.0.11
Do I have to apply a url decode algorithm when the web page loads?
That is far from ideal because the problem here is that the browser
is not showing the decoded url.

Is this a bug in FF?

There is no problem with this whatsoever in Firefox 2, I can tell you
that. Use &amp; in your links and images and so forth and it'll work.
So exactly what should happen.

If I have, say:
<a href="../page1.aspx?a=1& amp;b=gonow">Go Now</a>
in my html, on clicking the link, will FF give :
blah blah/page1.aspx?a=1& b=gonow
in the address bar?

It's not doing that for me. It gives
blah blah/page1.aspx?a=1& amp;b=gonow

Which the server reads and tells me that it can't get my querystrings.
I suppose I can url decode this at the server end to fix it.
Dec 17 '07 #9
"mark4asp" <ma******@gmail .comwrites:
Which the server reads and tells me that it can't get my querystrings.
I suppose I can url decode this at the server end to fix it.
The easy way out is to allow ';' as well as '&' as a separator. Most
web languages/CGI libraries support this either by default or as an
option.

--
Chris
Dec 17 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2114
by: Gordon - Adelphia | last post by:
I have a question regarding xhtml. Why, why, why does the ELEMENT <body> allow “unblocked” text. HTML does not (though, most browsers will render). Xhtml (transitional) however allows text nodes (PCDATA). All of HTML 4, xhtml – transitional, and xhtml-strict allow <div> to contain “unblocked” text. Does anybody know why – I’m looking for the...
50
3790
by: Christopher Benson-Manica | last post by:
(if this isn't the place for XHTML, I'd appreciate a redirect) According to the w3's web site, some non-HTML 4 browsers won't properly interpret non-minimized boolean attributes, i.e. <option value="blah" selected="selected">...</option> ^^^^^^^^^^^ Can anyone tell me what browsers those might be? I'm in the process of converting some...
41
1248
by: CMAR | last post by:
What are the pluses and minuses of constructing and validating between XHTML Transitional vs. HTLM 4.01 Strict Thanks, CMA
82
5634
by: Buford Early | last post by:
I read this in http://annevankesteren.nl/2004/12/xhtml-notes "A common misconception is that XHTML 1.1 is the latest version of the XHTML series. And although it was released a bit more than a year later then the first version of XHTML 1.0, the second edition is actually newer. Furthermore, XHTML 1.1 is not really the follow-up of XHTML...
10
4897
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...
15
4326
by: Zhang Weiwu | last post by:
http://www.w3.org/MarkUp/2004/xhtml-faq provided a trick to serve xhtml webpage to IE as application/xml I used that trick and now every one of my xhtml webpage have following first 4 starting lines: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="curseIE.xsl"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
4
1734
by: Marijn | last post by:
Hey everybody, The following has been posted before (2 years ago) but no response was added. Therefor again, the following code for creating xhtml file: <?php error_reporting(6143); $xmlns = "http://www.w3.org/1999/xhtml";
2
2124
by: pratibharaut | last post by:
Hello friends, I am trying to make XHTML pages with PHP . But when i write the php code it doesnt work. It works for plain XHTML. For run that pages i am using WAP Proof software. The code is here --------------test.xhtml---------------- <!DOCTYPE html
1
1968
by: DeveloperQuest | last post by:
How do I make Xhtml 1.0 strict or Xhtml 1.1 strict appear in the Visual Studio 2005 dropdown? How do I add a Xhtml 1.0 strict to the dropdown in visual studio 2005? I have used the default selection XHTML 1.0 Transistional. I have added <xhtmlConformance mode="Strict" /> in the web.config.
0
7615
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7539
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
8055
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
7581
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...
1
5446
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
5165
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
3566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
858
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.