The encoding label per WHATWG Encoding spec
Input scalar-value string to encode
A string of ASCII chars to escape in addition to C0 control percent-encode set
OptionalspaceAsPlus: booleanWhether to encode space as '+' instead of '%20' or ' ' (default: false)
The percent-encoded string
Implements percent-encode after encoding per WHATWG URL specification.
You must import
@exodus/bytes/encoding.jsfor this API to accept legacy multi-byte encodings.Encodings
utf16-le,utf16-be, andreplacementare not accepted.C0 control percent-encode set is always percent-encoded.
percentEncodeSetis an addition to that, and must be a string of unique increasing codepoints in range 0x20 - 0x7e, e.g.' "#<>'.This method accepts DOMStrings and converts them to USVStrings. This is different from e.g.
encodeURIandencodeURIComponentwhich throw on surrogates: