I have a url with querystrings through which some data are passed. I want to retrieve the data in the server side. What is the solution for this problem
Decoding a URLdecodeURI() function − The decodeURI() function is used to decode the URI, i.e., converting the special characters back to the original URI language. decodeURIComponent() function − This function decodes the complete URL back to its original form.
If you have a complete URL, use encodeURI . But if you have a part of a URL, use encodeURIComponent .
The encodeURI() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two "surrogate" characters).
You can use escape ( http://www.w3schools.com/jsref/jsref_escape.asp ) or encodeURI ( http://www.w3schools.com/jsref/jsref_encodeuri.asp ) to encode on Javascript side.
On server side: For C# - Use System.Web.HttpUtility.UrlDecode to decode ( http://msdn.microsoft.com/en-us/library/adwtk1fy.aspx ) For Java - Use URLDecoder to decode ( http://download.oracle.com/javase/1.5.0/docs/api/java/net/URLDecoder.html ) For PHP - Use urldecode ( http://php.net/manual/en/function.urldecode.php )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With