Skip to main content

quote

Function quote 

Source
pub fn quote(string: &str, safe: &str) -> String
Expand description

Percent-encode a string. Letters, digits and _.-~ are never quoted; everything else outside safe becomes %XX. The string is encoded as UTF-8 first. Port of quote (str input).

Python’s quote defaults safe to "/"; pass it explicitly here.

use urlparse_rs::quote;
assert_eq!(quote("/El Niño/", "/"), "/El%20Ni%C3%B1o/");