使用xhtml 1.0严格时,网址中的&符号 [英] ampersand in urls when using xhtml 1.0 strict

查看:62
本文介绍了使用xhtml 1.0严格时,网址中的&符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用xhtml写一个url时,带有未编码的&符号,如下:

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


xhtml sytax检查器正确指示错误,告诉我

应该是:

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


见:< http://www.htmlhelp.com/tools/validator/problems.html#amp>


然而最后一句话结束:


浏览器翻译& amp;"到&所以Web服务器只会看到&而不是& amp;在请求的查询字符串中。


我的网络服务器清楚地看到& amp; amp;和浏览器(FF 1.0.0.11)

也显示& amp; amp;在网址中。


我正在使用:

<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN"

" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


没有xml前缀因为,众所周知,当存在xml

前缀时IE6会中断。


这个问题的原因和解决方法是什么。


我正在使用FF 1.0.0.11,通过本地asp.net 2.0站点通过WinXP SP2上的mini

webserver(Cassini)安装了所有最新的o / s更新

(除了IE7,我在这台电脑上使用IE6)。


网页加载时我是否需要应用网址解码算法?

这远非理想,因为这里的问题是浏览器没有显示解码的网址。


这是一个FF中的错误?


最后是否有一个DOCTYPE我可以用来强制所有5个主流浏览器:

IE6,IE7,FF,Opera,Safari to全部渲染

显示xhtml时的严格模式?

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.com/tools/validator/problems.html#amp>

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?

推荐答案

mark4asp写道:
mark4asp wrote:

当我用xhtml写一个url时,带有未编码的&符号,如下:

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


xhtml sytax检查器正确指出错误,告诉我

应该是:

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


见:< http://www.htmlhelp.com/tools/validator/problems.html#amp>


然而最后一句话结束了:


浏览器翻译& amp;"到&所以Web服务器只会看到&而不是& amp;在请求的查询字符串中。


我的网络服务器清楚地看到& amp; amp;和浏览器(FF 1.0.0.11)

也显示& amp; amp;在网址中。


我正在使用:

<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN"

" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


没有xml前缀因为,众所周知,当存在xml

前缀时IE6会中断。


这个问题的原因和解决方法是什么。


我正在使用FF 1.0.0.11,通过本地asp.net 2.0站点通过WinXP SP2上的mini

webserver(Cassini)安装了所有最新的o / s更新

(除了IE7,我在这台PC上使用IE6)。
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.com/tools/validator/problems.html#amp>

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).



您使用的是1.0.0.11吗?问题在于它实际上是第一个发布的第一个

版本,并且它在几年内被取代了1.0.1美元,比两年前增加了1.5美元。 ,和一年前的2.0。基于我参与的高流量网站的
使用情况,几乎没有人使用Firefox 1.x再次使用
(可能是因为Firefox提示你

更新它),你*当然*不应该用
版本做任何事情,只要产品已经过了十倍就过时了更换版本时存在

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.


>

网页加载时我是否需要应用网址解码算法?

那个远非理想,因为这里的问题是浏览器没有显示解码的网址。


这是FF中的错误吗?
>
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?



在Firefox 2中没有任何问题,我可以告诉你

。使用& amp;在你的链接和图像等等它会工作。

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.


mark4asp写道:
mark4asp wrote:

当我用xhtml写了一个url,带有未编码的&符号,如下:

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


xhtml sytax检查器正确表示错误,告诉我

应该是:

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


见:< http://www.htmlhelp.com/tools/validator/problems.html#amp>


然而最后一句话结束:


浏览器翻译& amp;"到&所以Web服务器只会看到&而不是& amp;在请求的查询字符串中。


我的网络服务器清楚地看到& amp; amp;和浏览器(FF 1.0.0.11)

也显示& amp; amp;在网址中。


我正在使用:

<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN"

" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


没有xml前缀因为,众所周知,当存在xml

前缀时IE6会中断。


这个问题的原因和解决方法是什么。


我正在使用FF 1.0.0.11,通过本地asp.net 2.0站点通过WinXP SP2上的mini

webserver(Cassini)安装了所有最新的o / s更新

(除了IE7,我在这台电脑上使用IE6)。


网页加载时我是否需要应用网址解码算法?

这远非理想,因为这里的问题是浏览器没有显示解码的网址。


这是一个FF中的bug?


最后是否有一个DOCTYPE我可以使用强制所有5个主要的b
浏览器:IE6,IE7,FF,Opera,Safari来所有都是严谨的t模式

显示xhtml时?
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.com/tools/validator/problems.html#amp>

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?



现在解决了眼前的问题。不知何故,带有网址的页面是

缺少Content-Type标题:

< meta http-equiv =" Content-Type"含量=" text / html的;字符集= UTF-8英寸/>


包含此标题后,我可以删除编码的

&符号,[& amp; ],用一个&替换它们。 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.
--


.. oO(mark4asp)
..oO(mark4asp)

>现在解决了眼前的问题。不知何故,带有网址的网页缺少Content-Type标头:
< meta http-equiv =" Content-Type"含量=" text / html的;字符集= UTF-8英寸/>
>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.


>包含这个标题后,我能够删除编码的&符号,& amp; amp; ],用一个&替换它们。 xhtml
语法检查器不再在此处显示错误,页面导航现在可以正常工作。
>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.



我对此表示怀疑。 URL中的&符号_必须编码。


Micha

I doubt that. Ampersands in a URL _must_ be encoded.

Micha


这篇关于使用xhtml 1.0严格时,网址中的&符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆