开发者

ASP.NET + QueryString Encoding Problem

I'm passing query string parameter to .aspx page with 'Ñ' character in value. But Request.QueryString returns some other box '[]' character in return. I t开发者_JAVA技巧hink this request encoding issue. and I do not want to use that HttpUtility.UrlDecode and HttpUtility.UrlEncode methods.

Does anyone know how to solve this?


You'll have to be a little more precise as how you are passing this parameter and where does it come from but you could set request and response encoding in your web.config file:

<system.web>
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>


You should look Base 64 encoding scheme to solve this problem.


Are you sure it's a different character? It could be that the 'Ñ' isn't representable in whatever font the IDE is using to inspect it (assuming that's where you're seeing the "box").


Solved. 'N' with Tilde => 'Ñ' comes under ISO-8859-1

Use following under web.config

<system.web> 
    <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" /> 
</system.web> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜