urlEncode
Percent-encodes text so it can sit inside a URL.
Details #
urlEncode(text) takes exactly one argument and returns text. Letters, digits and - . _ ~ stay as they are. Every other character, spaces and / ? & = : included, becomes %XX (UTF-8 bytes).
Parameters #
Takes 1 argument.
{{ urlEncode(text) }}
Examples #
urlEncode("a b&c")→
a%20b%26c"https://example.com/search?q=" + urlEncode(term)→
https://example.com/search?q=mac%20automation| Sample variable | Value |
|---|---|
term | mac automation |
Gotchas #
Encode each piece (a query value, a path part), not a whole URL: the
:and/ofhttps://would be encoded too.