Arabic QueryString problem (???? in the value)

我与影子孤独终老i 提交于 2019-12-04 14:38:50

Just URL Encode the arabic string and it should work fine.

Edit: You must URL Encode the string before putting it in the querystring.

For instance, if you were to url encode the space character, it will appear as %20 in your querystring, like this:

http://foo.com/dosomething?param1=hello%20world

Then when you read param1 you URL Decode it, and you get the string "hello world"

You could also URL Encode every single character but for regular characters it's pointless.

moien ghorbany

I had a similar problem and solved it by putting the following line in my web.config file:

<globalization fileEncoding="windows-1256" 
    requestEncoding="windows-1256" responseEncoding="windows-1256"/>"

And this in the head section of my HTML page:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

I sent an Arabic text in my query string

and when I resieved this string it was Encoded

after Server.UrlDecode

 departmentName = Server.UrlDecode(departmentName);

it back again to arabic

so just use Server.UrlDecode(encodedString);

Hope this help you

The Non english characters can't be passed without being encoded ,

so you need to encode the value before you redirect to the target page as follows:

string text="مرحبا";
text=Server.UrlEncode(text);
string url="http://server/mypage.aspx?qs="+text;
Response.Redirect(url);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!