Home >Web Front-end >JS Tutorial >Introduction to the use of encodeURI and decodeURI methods in javascript_javascript skills

Introduction to the use of encodeURI and decodeURI methods in javascript_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:34:401212browse
1. Basic concepts
encodeURI and decodeURI are used in pairs, because if there are Chinese characters in the browser's address bar, unexpected errors may occur, so encodeURI can convert non-English characters For English encoding, decodeURI can be used to restore characters back. The encodeURI method does not encode the following characters: ":", "/", ";" and "?", the encodeURIComponent method can encode these characters.
decodeURI() method is equivalent to java.net.URLDecoder.decode(URIString, "UTF-8");
encodeURI() method is equivalent to java.net.URLEncoder.encode(URIString, "UTF-8" ; 🎜>