URLDecode

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
the URLDecode of <formString>
URLDecode(<formString>)
Summary

Returns the decoded form of a URL that was encoded for posting to an HTTP server.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
formString
Example
URLDecode("A+B%2F1+2") -- returns "A B/1 2"
put URLDecode(field "Test URL") after URLToCheck
Values
NameTypeDescription
return

The URLDecode function returns the formString with plus signs "+" converted to spaces and characters in the form %NN converted to the ASCII equivalent of the hexadecimal number NN.

RelatedKeyword: URL, characters, character, http
Property: httpHeaders
Command: post
Function: decompress, macToISO, arrayDecode, charToNum, baseConvert, textDecode
Control Structure: function
Glossary: decode, return, sign, encode, character set, hexadecimal, server, function
Description

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.

Note: Non-ASCII characters, such as Unicode, that appear in the URL string to be decoded will have been encoded as UTF-8 (as per standard convention), requiring the use of the textDecode function after urlDecode. For example, the following code:

local tEncodedText
put "%D1%81%D0%BA%D0%BE%D1%80%D0%BE%D1%81%D1%88%D0%B8%D0" & \
      "%B2%D0%B0%D1%82%D0%B5%D0%BB%D1%8C" into tCodedText
put textDecode(urlDecode(tEncodedText),"UTF-8")

produces the word "??????????????".

Tagsnetworking