- encodeURI is used to encode a string with special characters including foreign language.
- decodeURI is used to decode the string.
var uri = "url goes here.aspx?language=हिन्दी";
alert(encodeURI(uri));
alert(decodeURI(encodeURI(uri)));
Encode Output: url%20goes%20here.aspx?language=%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80Decode Output: url goes here.aspx?language=हिन्दी