EncodeURIComponent/decodeURIComponent: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 33: | Line 33: | ||
== Related Items == | == Related Items == | ||
[[escape/unEscape|escape]], [[escape/unEscape|unescape]], [[ | [[escape/unEscape|escape]], [[escape/unEscape|unescape]], [[encodeURI/decodeURI|encodeURI]], [[encodeURI/decodeURI|decodeURI]] | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Variable Handling]] | [[Category:Variable Handling]] |
Revision as of 21:06, 30 December 2013
encodeURIComponent(URI)
decodeURIComponent(URI)
Description
The encodeURIComponent() function encodes a URI component. This function encodes special characters. In addition, it encodes the following characters: , / ? : @ & = + $ #
The decodeURIComponent() function decodes a URI component.
Example (Basic)
Encode a URI:
uri = "http://w3schools.com/my test.asp?name=st�le&car=saab" Print "Encoded URI: " & encodeURIComponent(uri)
The result of res will be:
Encoded URI: http%3A%2F%2Fw3schools.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab
Example (JavaScript)
Encode a URI:
var uri = "http://w3schools.com/my test.asp?name=st�le&car=saab"; Print("Encoded URI: " & encodeURIComponent(uri));
The result of res will be:
Encoded URI: http%3A%2F%2Fw3schools.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab