pub fn urlencode_strict<T>(
s: T,
) -> Result<HtmlSafeOutput<UrlencodeFilter<T>>, Infallible>Expand description
Percent-encodes the argument for safe use in URI; encodes /.
Use this filter for encoding query keys and values in the rare case that the server can’t process them unencoded.
Encodes all characters except ASCII letters, digits, and _.-~. In other
words, encodes all characters which are not in the unreserved set,
as specified by RFC3986.
<a href="/page?text={{ "look, unicode/emojis ✨"|urlencode_strict }}">Page</a>If you want to preserve /, see urlencode.
/// ```jinja
/// <a href='{{ example|urlencode_strict }}'>Example</a>
/// ```
#[derive(Template)]
#[template(ext = "html", in_doc = true)]
struct Example<'a> {
example: &'a str,
}
assert_eq!(
Example { example: "/hello/world" }.to_string(),
"<a href='%2Fhello%2Fworld'>Example</a>"
);