UrlDecode - ObjectVision/GeoDMS GitHub Wiki

String functions UrlDecode

The UrlDecode function decodes URL-encoded strings back to their original form.

syntax

UrlDecode(strings: E->String) -> E->String

definition

Converts URL-encoded strings back to their original format by replacing percent-encoded sequences with the corresponding characters (e.g., %20 becomes space, %26 becomes &). It is the exact inverse of UrlEncode.

Common encodings that are decoded:

  • %20 → space
  • %26 → &
  • %3D → =
  • %2F → /
  • %3A → :
  • %3F → ?
  • A plus sign (+) is decoded to a space; a literal plus must therefore be encoded as %2B
  • Percent-encoded non-ASCII bytes are passed through as bytes, so UTF-8 sequences (e.g. %C3%BC) decode to UTF-8 text

arguments

argument description type
strings URL-encoded strings to decode E->String

performance

Time complexity: O(n × L) where n is the number of strings and L is the average string length.

Decoded strings are typically shorter than input strings.

conditions

  • An invalid percent sequence (e.g. %ZZ, or a % at the end of the string) is an error: UrlDecode: invalid escape code
  • UTF-8 encoded sequences are properly decoded

example

unit<uint32> EncodedParams: nrofrows = 3;
attribute<String> encoded (EncodedParams) := union_data(EncodedParams,
    'hello%20world',
    'price%3D100%26tax%3D20',
    'name%3DM%C3%BCller'
);

attribute<String> decoded (EncodedParams) := UrlDecode(encoded);
// decoded = {'hello world', 'price=100&tax=20', 'name=Müller'}

see also

since version

7.0

⚠️ **GitHub.com Fallback** ⚠️