The encodeURIComponent() function encodes a URI by replacing each instance of certain characters with one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two surrogate characters). Compared to encodeURI(), this function encodes more characters, including those that are part of the URI syntax.
var baseURL = "https://system.na3.netsuite.com/app/common/item/item.nl";
var param = "user123@test.com";
var url = baseURL + "?email=" + encodeURIComponent(param);
window.open(url, "_self");
Syntax – encodeURIComponent(uriComponent)
Parameters – uriComponent
A string to be encoded as a URI component (a path, query string, fragment, etc.). Other values are converted to strings.
Return Value – A new string representing the provided uriComponent encoded as a URI component.
encodeURIComponent() is a function property of the global object. It uses the same encoding algorithm as described in encodeURI(). It escapes all characters except:
A–Z a–z 0–9 - _ . ! ~ * ' ( )