Skip to content

Conformance Examples 0.1.0 — Transforms: transform-url_decode

url_decode-basic

Plus signs become spaces; percent-sequences become their literal characters.

Template

{{{ q | url_decode }}}

Context

{
    "q": "hello+world%21"
}

Output

hello world!

url_decode-lowercase-hex

Lowercase hex digits in percent-sequences decode correctly.

Template

{{{ q | url_decode }}}

Context

{
    "q": "%c3%a9"
}

Output

é

url_decode-uppercase-hex-multibyte

Multi-byte UTF-8 sequences decode to the original character.

Template

{{{ q | url_decode }}}

Context

{
    "q": "caf%C3%A9"
}

Output

café

url_decode-empty

Empty input decodes to empty output.

Template

{{{ q | url_decode }}}

Context

{
    "q": ""
}

Output


url_decode-malformed-non-hex-is-null

Percent-sequence whose digits are not hex is a soft failure, so url_decode yields null.

Template

{{{ q | url_decode }}}

Context

{
    "q": "bad%G1value"
}

Output

null

url_decode-malformed-low-nibble-is-null

Percent-sequence whose second digit is not hex is a soft failure, so url_decode yields null.

Template

{{{ q | url_decode }}}

Context

{
    "q": "ab%1Gcd"
}

Output

null

url_decode-trailing-percent-is-null

Trailing percent with no digits is a soft failure, so url_decode yields null.

Template

{{{ q | url_decode }}}

Context

{
    "q": "ab%"
}

Output

null

Source fixture: transforms/transform-url_decode.json