如何在查询字符串中获取/获取unicode字符? [英] How to fetch/take unicode character in querystring?

查看:121
本文介绍了如何在查询字符串中获取/获取unicode字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have created one page and giving url to client.client can enter name in the form of querystring.That name can be unicode character.

like : www.domainname.com/page1.aspx?name=जगती

But when I am catching name in form of querystring getting ????.How to handle this?

string str = Convert.Tostring(Request.QuertString["name"]);





我尝试过:





What I have tried:

string str = Convert.Tostring(Request.QuertString["name"]);

推荐答案

首先,我觉得这种方法需要审查并考虑从客户端获取数据的更好方法,而不是通过查询字符串获取数据由客户直接输入。例如,您通过文本框获取此值,然后正确编码值并根据您的要求通过查询字符串或其他选项发送。



但是,如果您的需求需要此要完全使用裸查询字符串操作,您可以尝试在 system.web 标记下的web.config文件中设置以下内容。

First of all, I feel the approach need to reviewed and consider about better approach to get data from client rather than getting it via querystring directly inputted by the client. For example, you get this via a textbox and then encoding the value correctly and send via querystring or other options as per your requirement.

However, if your requirement needs this to be done really with bare querystring manipulation, you can try setting following in the web.config file under system.web tags.
<globalization fileEncoding="iso-8859-1" requestEncoding="iso-8859-1"responseEncoding="iso-8859-1"/>





参考:如何从asp.net中具有UNICODE值的URL获取正确的QueryString值? - Stack Overflow [ ^ ]



希望,它有帮助:)



Reference: How to get Correct QueryString Value from URL having UNICODE value in asp.net? - Stack Overflow[^]

Hope, it helps :)


这篇关于如何在查询字符串中获取/获取unicode字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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