I am sending an arabic value in a querystring, when retrieving it on the server, the value is erroneous and is replaced by quotation marks (????). for example: http://server/mypage.aspx?qs=مرحبا the value of Request.QueryString("qs") is ?????
Note that Response.Write('مرحبا') executes correctly.
Any idea about this querystring problem?
Thanks.
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.
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">
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);
来源:https://stackoverflow.com/questions/3091550/arabic-querystring-problem-in-the-value