Click here to Skip to main content
15,121,891 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How to read special characters(non English characters) from URL query string?
when my query string has a value in Arabic language like "key=رياضه" the value changed and become ????????
Posted
Updated 24-Mar-14 4:08am
v2
Comments
Keith Barrow 24-Mar-14 9:02am
   
Hi, can you clarify whether you want non-English characters (e.g. Arabic in your case I guess) or special characters (such as + , ? etc) please.
Mohammad A. Amer 24-Mar-14 9:14am
   
when my query string has a value in Arabic language like "key=رياضه" the value changed and become ????????
Bernhard Hiller 24-Mar-14 9:23am
   
What about URLEncode and URLDecode functions?
Mohammad A. Amer 25-Mar-14 5:34am
   
how can I use it as i want the same characters in the query string to search the db by them?
Raul Iloc 24-Mar-14 14:35pm
   
Did you try my solution?
Mohammad A. Amer 25-Mar-14 7:01am
   
yes, but not worked with me.
Raul Iloc 25-Mar-14 7:21am
   
If you use Arabic, should work. Maybe you forgot to clear the browser cache and to close and reopen the browser!?

1 solution

In you master page (layout or pages) you should specify the using of UTF-8 like in the next example:
HTML
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


Then in your web.config file you should have the next settings for specifying encoding for Arabic:
HTML
<globalization fileencoding="windows-1256">
    requestEncoding="windows-1256" responseEncoding="windows-1256"/></globalization>
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900