Querystring编码utf-8 [英] Querystring encoding utf-8

查看:136
本文介绍了Querystring编码utf-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我们的网站需要支持utf-8,因此web.config有请求和响应

编码设置为utf-8。问题是Request.Querystring不支持
支持这个并且我们已经尝试在新闻组中找到解决方案,但是

找不到一个。这些建议包含了HttpUtility函数,但是

Request.Querystring已经尝试解码查询字符串。 Utf-8是ASP.NET中的

详细编码,所以奇怪的是一个URL如

www.mysite.com/default.aspx?q=s??k


不起作用。 Request.Querystring(" q")返回" sk"在这种情况下。

Request.RawUrl返回正确的Url。我们有什么方法可以使用

Request.Querystring for url参数和启用UTF-8编码?我们是使用Javascript传递查询字符串的
并试图在

传递它之前将其转义但Request.Querystring只是简单地删除了国际

字符


谢谢,

Manso

解决方案

网址规范要求8位字符编码,IIRC,所以没有unicode。

对不起。


-Brock

DevelopMentor
< a rel =nofollowhref =http://staff.develop.com/ballentarget =_ blank> http://staff.develop.com/ballen



我们的网站需要支持utf-8,因此web.config将请求和
响应编码设置为utf-8。问题是
Request.Querystring不支持这个,我们试图在新闻组中找到一个
解决方案,但找不到。建议
包含HttpUtility函数,但Request.Querystring已经尝试过解码查询字符串。 Utf-8是ASP.NET中的详细编码,所以

www.mysite.com/default.aspx?q=s?k

没有''工作。 Request.Querystring(" q")返回" sk"在这种情况下。
Request.RawUrl返回正确的Url。我们有什么方法可以使用Request.Querystring来启用url参数和UTF-8编码吗?
我们正在使用Javascript传递查询字符串并试图在传递它之前将其转义但是Request.Querystring只是简单地将国际角色拉开了

谢谢,
Manso




< blockquote>我找到了一个解决方案:

http://blog.hackedbrain.com/archive/2005/04/11/370.aspx

encodeURIComponent而不是客户端的转义诀窍。


谢谢,

Manso


" Brock Allen"写道:

URL的规范要求8位字符编码,IIRC,所以没有unicode。
抱歉。

-Brock
DevelopMentor
http://staff.develop.com/ballen



我们的网站需要支持utf-8,因此web.config将请求和
响应编码设置为utf-8。问题是
Request.Querystring不支持这个,我们试图在新闻组中找到一个
解决方案,但找不到。建议
包含HttpUtility函数,但Request.Querystring已经尝试过解码查询字符串。 Utf-8是ASP.NET中的详细编码,所以

www.mysite.com/default.aspx?q=s??k

不不行。 Request.Querystring(" q")返回" sk"在这种情况下。
Request.RawUrl返回正确的Url。我们有什么方法可以使用Request.Querystring来启用url参数和UTF-8编码吗?
我们正在使用Javascript传递查询字符串并试图在传递它之前将其转义但是Request.Querystring只是简单地将国际字符拉下来

谢谢,
Manso




顺便说一句,它是RFC-1738,它特别说明了URL的US-ASCII。

http://www.faqs.org/rfcs/rfc1738.html


-Brock

DevelopMentor
http://staff.develop.com/ ballen

URL规范要求8位字符编码,IIRC,所以没有
unicode。对不起。

-Brock
DevelopMentor
http ://staff.develop.com/ballen



我们的网站需要支持utf-8,所以web.config既有请求也有
响应编码设置为utf-8。问题是
Request.Querystring不支持这个,我们试图在新闻组中找到一个
解决方案,但找不到。建议
包含HttpUtility函数,但Request.Querystring已经尝试解码查询字符串。 Utf-8是ASP.NET中的详细编码,因此很奇怪,例如

www.mysite.com/default.aspx?q=s?k

没有''工作。 Request.Querystring(" q")返回" sk"在这种情况下。
Request.RawUrl返回正确的Url。我们有什么方法可以使用Request.Querystring来启用url参数和UTF-8编码吗?
我们正在使用Javascript传递查询字符串并试图在传递它之前将其转义但是Request.Querystring只是简单地将国际字符取消

谢谢,
Manso




Hi,

Our sites need to support utf-8 so web.config has both request and response
encoding set to utf-8. The problem is that Request.Querystring doesn''t
support this and we''ve tried to find a solution in the newsgroups but
couldn''t find one. The suggestions invole HttpUtility functions but
Request.Querystring has already tried to decode the querystring. Utf-8 is the
detault encoding in ASP.NET so it''s strange that a url such as

www.mysite.com/default.aspx?q=s??k

doesn''t work. Request.Querystring("q") returns "sk" in this case.
Request.RawUrl returns the correct Url. Is there any way we can use
Request.Querystring for url parameters and UTF-8 encoding enabled? We''re
passing the querystring using Javascript and have tried to escape it before
passing it in but Request.Querystring simplycuts away the international
characters

Thanks,
Manso

解决方案

The spec for URLs mandates 8 bit character encoding, IIRC, so no unicode.
Sorry.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Hi,

Our sites need to support utf-8 so web.config has both request and
response encoding set to utf-8. The problem is that
Request.Querystring doesn''t support this and we''ve tried to find a
solution in the newsgroups but couldn''t find one. The suggestions
invole HttpUtility functions but Request.Querystring has already tried
to decode the querystring. Utf-8 is the detault encoding in ASP.NET so
it''s strange that a url such as

www.mysite.com/default.aspx?q=s?k

doesn''t work. Request.Querystring("q") returns "sk" in this case.
Request.RawUrl returns the correct Url. Is there any way we can use
Request.Querystring for url parameters and UTF-8 encoding enabled?
We''re passing the querystring using Javascript and have tried to
escape it before passing it in but Request.Querystring simplycuts away
the international characters

Thanks,
Manso




I found a solution:

http://blog.hackedbrain.com/archive/2005/04/11/370.aspx

encodeURIComponent instead of escape on client side does the trick.

Thanks,
Manso

"Brock Allen" wrote:

The spec for URLs mandates 8 bit character encoding, IIRC, so no unicode.
Sorry.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Hi,

Our sites need to support utf-8 so web.config has both request and
response encoding set to utf-8. The problem is that
Request.Querystring doesn''t support this and we''ve tried to find a
solution in the newsgroups but couldn''t find one. The suggestions
invole HttpUtility functions but Request.Querystring has already tried
to decode the querystring. Utf-8 is the detault encoding in ASP.NET so
it''s strange that a url such as

www.mysite.com/default.aspx?q=s??k

doesn''t work. Request.Querystring("q") returns "sk" in this case.
Request.RawUrl returns the correct Url. Is there any way we can use
Request.Querystring for url parameters and UTF-8 encoding enabled?
We''re passing the querystring using Javascript and have tried to
escape it before passing it in but Request.Querystring simplycuts away
the international characters

Thanks,
Manso




BTW, it''s RFC-1738, and it specifically says US-ASCII for URLs.

http://www.faqs.org/rfcs/rfc1738.html

-Brock
DevelopMentor
http://staff.develop.com/ballen

The spec for URLs mandates 8 bit character encoding, IIRC, so no
unicode. Sorry.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Hi,

Our sites need to support utf-8 so web.config has both request and
response encoding set to utf-8. The problem is that
Request.Querystring doesn''t support this and we''ve tried to find a
solution in the newsgroups but couldn''t find one. The suggestions
invole HttpUtility functions but Request.Querystring has already
tried to decode the querystring. Utf-8 is the detault encoding in
ASP.NET so it''s strange that a url such as

www.mysite.com/default.aspx?q=s?k

doesn''t work. Request.Querystring("q") returns "sk" in this case.
Request.RawUrl returns the correct Url. Is there any way we can use
Request.Querystring for url parameters and UTF-8 encoding enabled?
We''re passing the querystring using Javascript and have tried to
escape it before passing it in but Request.Querystring simplycuts
away the international characters

Thanks,
Manso




这篇关于Querystring编码utf-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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