Skip to main content

decode

Function decode 

pub fn decode(s: &str) -> String
Expand description

Percent-decode a URI component per RFC 3986: %XX escapes are decoded and + is left as a literal plus.

This is the right rule for path segments and for query strings that are not form data (an otpauth:// key URI, a file:// path, a media type).

Invalid UTF-8 in the decoded bytes is replaced rather than erroring, and a malformed escape (%2, %zz) is passed through verbatim — robustness over strictness, since these strings come from other people’s encoders.