Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to Decode a string in WCF page or web service page which has been encoded in Jquery using 'escape()' , the encoded string is in this format 'Manual%20Analysis'
it should be decoded to 'Manual analysis' in WCF page. the encoding may vary.

JavaScript
prefixText = escape(prefixText);
Posted

check which one gives you the best results
C#
HttpUtility.UrlDecode(encodedString, System.Text.Encoding.Default);

C#
System.Uri.UnescapeDataString(encodedString);


URL decode gives incorrect decoding for some characters (like for "+")

there is one more method named HtmlDecode in HttpUtility, check which one suits you best.
 
Share this answer
 
Comments
Abhisheik yk 8-May-13 5:38am    
Thank you @skantg , the Uri.UnescapeDatastring(); works perfect.
check which one gives you the best results
C#
HttpUtility.UrlDecode(encodedString, System.Text.Encoding.Default);

C#
System.Uri.UnescapeDataString(encodedString);


URL decode gives incorrect decoding for some characters (like for "+")

there is one more method named HtmlDecode in HttpUtility, check which one suits you best.
 
Share this answer
 

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