encodeURI

encodeURIencodeURI(uri)
Replaces special characters in a URI with escape sequences.