Url Encode / Decode using Javascript

Javascript has some inbuilt Url Encoding and Decoding functions:
  • encodeURI is used to encode a string with special characters including foreign language.
  • decodeURI is used to decode the string.
Let's see an example here in javascript.
    var uri = "url goes here.aspx?language=हिन्दी";
Encode Output: url%20goes%20here.aspx?language=%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80
Decode Output: url goes here.aspx?language=हिन्दी

Share item with friends