var str="st. John's"; var str2=escape(str); alert(str2); //st.%20John%27s
Not all special characters will be converted, @, *, +, -, /, ., @, _, will not be converted.
var str="test@gmail.com"; var str2=escape(str); alert(str2); //test@gmail.com
var str="st. John's"; var str2=escape(str); alert(str2); //st.%20John%27s var str3 = unescape(str2); alert(str3); //st. John's