util.Strings.urlDecode() converts a URL-encoded string to the application character encoding.
Syntax
util.Strings.urlDecode(string)
Parameters
|
string |
a string that must be converted (STRING) |
Usage and examples
util.Strings.urlDecode()
DISPLAY util.Strings.urlEncode("Hello%2c+world!")
The source string must contain ASCII characters and/or %xx hexadecimal representation of the UTF-8 encoding bytes.
util.Strings.urlDecode() is error-tolerant: Alphabetical characters of the %xx elements can be both uppercase or lowercase:
%b2 = %B2.
If
the source string includes a %xx
element that represents a UTF-8 encoded character which doesn't exist
in the application locale, this %xx
element will be converted to a question mark (
).
If the percent character (%) is not followed by two hexadecimal digits, then this % is copied to the resulting string (and the decoder goes to the next character).
|
example code |
MAIN DISPLAY "Hello%2c+world!" DISPLAY util.Strings.urlDecode("Hello%2c+world!") DISPLAY "ABCDE" DISPLAY util.Strings.urlDecode("ABCDE") DISPLAY "%c3%a0%c3%a8%c3%a7%c3%9c%c3%96%c3%84" DISPLAY util.Strings.urlDecode("%c3%a0%c3%a8%c3%a7%c3%9c%c3%96%c3%84") DISPLAY "%3c%3d%3e" DISPLAY util.Strings.urlDecode("%3c%3d%3e") DISPLAY "%3C%3D%3E" DISPLAY util.Strings.urlDecode("%3C%3D%3E") DISPLAY "%3c%%3e" DISPLAY util.Strings.urlDecode("%3c%%3e") CALL fgl_getkey() END MAIN |
|
obtained results |
|