A URI is composed of a sequence of components separated by component separators. The general form is:
Scheme : First / Second ; Third ? Fourth
where the italicised names represent components and the “:”, “/”, “;”, “&” and “?” are reserved characters used as separators.
- encodeURI / decodeURI
- The encodeURI and decodeURI functions are intended to work with complete URIs; they assume that any reserved characters in the URI are intended to have special meaning and so are not encoded.
- encodeURIComponent / decodeURIComponent
- The encodeURIComponent and decodeURIComponent functions are intended to work with the individual component parts of a URI; they assume that any reserved characters represent text and so must be encoded so that they are not interpreted as reserved characters when the component is part of a complete URI.
- escape / unescape
- Encodes a string so it can be read on all computers. Computes a new version of a string value in which certain characters have been replaced by a hexadecimal escape sequence. For those characters being replaced whose code point value is 0xFF or less, a two-digit escape sequence of the form %xx is used. For those characters being replaced whose code point value is greater than 0xFF, a four-digit escape sequence of the form %uxxxx is used. This should not be used to encode URIs.
- encodeURL / decodeURL
- See encodeURI / decodeURI above.
- encodeURLComponent / decodeURLComponent
- See encodeURIComponent / decodeURIComponent above.