util.Strings.base64DecodeToString

Decodes a base64 encoded string and returns the corresponding string.

Syntax

util.Strings.base64DecodeToString(
  source STRING
 )
  RETURNING result STRING
  1. source is the Base64 encoded string.
  2. result is the decoded string.

Usage

The util.Strings.base64DecodeToString() method converts the Base64 encoded string passed as parameter to an array of bytes, then it converts the byte array to a string representation in the current locale, and returns that string.

If the Base64 source string contains a sequence of bytes that does not represent a valid character in the current application locale, the function returns NULL.

Note: In contrast to util.Strings.urlDecode, the original string is not converted from UTF-8 to the application character encoding: The Base64 source string must represent valid characters in the current application locale.

Example

IMPORT util
MAIN
    DEFINE base64 STRING
    LET base64 = util.Strings.base64EncodeFromString( "ForĂȘt" )
    DISPLAY base64
    DISPLAY util.Strings.base64DecodeToString( base64 )
END MAIN