Function urlparse::quote [] [src]

pub fn quote(s: &str, safe: &[u8]) -> Result<StringFromUtf8Error>

Replace special characters in string using the %xx escape. Letters, digits, and the characters '_.-' are never quoted.

Examples

use urlparse::quote;

let s = quote("test@example.com", &[]);
assert_eq!(s.ok().unwrap(), "test%40example.com");
let path = quote("/a/b/c", &[b'/']);
assert_eq!(path.ok().unwrap(), "/a/b/c");