Livecode Wiki
Advertisement

Returns the decoded form of a string that was encoded using urlencode or similar way ( for example for posting to an HTTP server).

Syntax:

URLDecode(<formString>)

Examples:

URLDecode("A+B%2F1+2") -- returns "A B/1 2"
put URLDecode(field "Test URL") after URLToCheck

Use the URLDecode function to decode a URL that has been sent by another system.

When the URLDecode function encounters a percent sign "%", it treats the next two characters as hexadecimal digits. (If one of the characters is not a hexadecimal digit, it's treated as a zero.) The number is converted to its character equivalent, using the character set currently in use.

Please note that tis function works only with UTF8 chars or chars that have the same value in UTF8, so if your computer doesn't use UTF8, use TextEncode and TextDecode like these examples:

put urlencode("Müller")
=
M%FCller
put urlencode(textEncode("Димитрий","UTF8"))
=
%D0%94%D0%B8%D0%BC%D0%B8%D1%82%D1%80%D0%B8%D0%B9
put urldecode("M%FCller")
=
Müller
put textdecode(urldecode("%D0%94%D0%B8%D0%BC%D0%B8%D1%82%D1%80%D0%B8%D0%B9"),"UTF8")
=
Димитрий

Parameters:

  • formString (string):
  • Returns:The URLDecode function returns the formString with plus signs "+" converted to spaces and characters in the form %NNconverted to the ASCII equivalent of the hexadecimal number NN.

See also: URLEncode, decompress (function),macToISO (function),arrayDecode (function),charToNum (function),baseConvert (function),httpHeaders (property),

Advertisement