Expand description
URI component encoder.
provides percent-encoding for URI components per RFC 3986.
§security notes
- this encoder is for URI components (query parameters, path segments, fragment identifiers), not entire URLs.
- it 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_
uri_ component - percent-encodes
inputfor safe use as a URI component. - write_
uri_ component - writes the percent-encoded form of
inputtoout.