Expand description
URI and form percent-encoders.
provides percent-encoding for URI components and paths per RFC 3986, and
for form values per the WHATWG URL Standard
(application/x-www-form-urlencoded).
§security notes
- these encoders are for URI components, paths, and form values, not entire URLs.
- they cannot make an untrusted full URL safe. a
javascript:URL will be percent-encoded but still execute. always validate the URL scheme and structure separately before embedding untrusted URLs. - the output is safe for direct embedding in HTML, CSS, and javascript contexts because all context-significant characters are percent-encoded.
Functions§
- for_
form_ urlencoded - percent-encodes
inputfor use as anapplication/x-www-form-urlencodedvalue. - for_
uri_ component - percent-encodes
inputfor safe use as a URI component. - for_
uri_ path - percent-encodes
inputfor safe use as a URI path. - write_
form_ urlencoded - writes the
application/x-www-form-urlencodedencoded form ofinputtoout. - write_
uri_ component - writes the percent-encoded form of
inputtoout. - write_
uri_ path - writes the percent-encoded URI path form of
inputtoout.