unquote
Written as unquote(argnum flags):options in a transform expression.
| Minimum arguments | 1 |
| Maximum arguments | 1 |
| Default arguments | 1 |
| Argument modes | SINGLE_PRIMITIVE |
Documentation
Section titled “Documentation”Decode URL-encoded text (percent-encoding).
Features:
- Decodes percent-encoded strings according to RFC 3986
- Handles both UTF-8 encoded and ASCII characters
- Preserves plus signs (+)
- Works with both strings and bytes objects
Behavior:
- Decodes %xx sequences to their corresponding characters
- Converts ‘+’ to space character unless alternative encoding specified
- Returns the same type as input (str or bytes)
- Preserves non-encoded characters as-is
| Flag | Letter |
|---|---|
| noncaptive_input | I |
Examples
Section titled “Examples”Basic URL decoding
Section titled “Basic URL decoding”Input args: ["Hello%20World%21"]Transforms: "unquote:"Output: "Hello World!"With plus signs
Section titled “With plus signs”Input args: ["first+last%40domain.com"]Transforms: "unquote:"Output: "[email protected]"With bytes input
Section titled “With bytes input”Input args: ["Hello%20World"]Transforms: "unquote:"Output: "Hello World"UTF-8 encoded characters
Section titled “UTF-8 encoded characters”Input args: ["%E4%BD%A0%E5%A5%BD"]Transforms: "unquote:"Output: "你好"Preserving plus signs
Section titled “Preserving plus signs”Input args: ["2%2B2%3D4"]Transforms: "unquote:"Output: "2+2=4"