{rawurlencode:string}

Description

Percent-encodes a string for safe use inside a URL, following RFC 3986 (the AA counterpart of PHP rawurlencode). Every character except letters, digits and the four unreserved marks - dash, underscore, dot, tilde - is replaced by a percent sign and its two-digit hex code: a space becomes %20, an ampersand %26, an equals sign %3D, a slash %2F. This is the preferred URL-encoder; the older urlencode command encodes a space as a plus sign (+) and is deprecated. The input is not trimmed, so leading and trailing spaces are encoded too. Typical use is wrapping a field value or search term before placing it in a link href or query string.

Parameters

string required default (empty string)

The text to percent-encode. Any value: a literal, a search term, or a field-getter such as a headline. Not trimmed, so surrounding spaces are encoded.

Examples

test{rawurlencode:Cafe au lait}
ExpectedCafe%20au%20lait
ActualCafe%20au%20lait
The everyday case: a plain string with spaces. Each space becomes %20 and the letters pass through unchanged.
test{rawurlencode:Praha 1}
ExpectedPraha%201
ActualPraha%201
Spaces are encoded as %20. This is the difference from the deprecated urlencode command, which would produce Praha+1 (a plus sign). Use rawurlencode for path segments and modern query strings.
test{rawurlencode:hello world & more}
Expectedhello%20world%20%26%20more
Actualhello%20world%20%26%20more
Reserved characters are escaped too: the ampersand becomes %26 so it cannot be mistaken for a separator between query parameters.
test{rawurlencode:novinky/2026}
Expectednovinky%2F2026
Actualnovinky%2F2026
A slash is escaped to %2F, so the encoded value stays inside one URL segment instead of being read as a path separator.
test{rawurlencode:q=1&r=2}
Expectedq%3D1%26r%3D2
Actualq%3D1%26r%3D2
Equals (%3D) and ampersand (%26) are escaped, so a value that itself looks like a query string is carried safely as a single parameter value.
test<a href="/hledat?q={rawurlencode:psi utulek}">psi utulek</a>
Expectedpsi utulek
psi utulek">Actualpsi utulek
The canonical real-world use: wrap a search term (here a literal; in practice a field-getter such as a headline) before placing it in a link href, so spaces and reserved chars cannot break the URL.