pub fn percent_decode(input: &[u8]) -> PercentDecode<'_> 
Expand description

Percent-decode the given bytes.

https://url.spec.whatwg.org/#percent-decode

Any sequence of % followed by two hexadecimal digits is decoded. The return type:

  • Implements Into<Cow<u8>> borrowing input when it contains no percent-encoded sequence,
  • Implements Iterator<Item = u8> and therefore has a .collect::<Vec<u8>>() method,
  • Has decode_utf8() and decode_utf8_lossy() methods.

§Examples

use percent_encoding::percent_decode;

assert_eq!(percent_decode(b"foo%20bar%3f").decode_utf8().unwrap(), "foo bar?");