IB Statements/base64
From CometWiki
BASE64 function
Syntax: BASE64(string-argument,numeric-error-argument)
Discussion: The BASE64 function performs a standardized encoding of the string-argument into printable characters, regardless of the value of the string-argument.
This function allows hex strings to be encoded and used for such purposes as hidden fields in an HTML form, cookies, etc. For more information about Base 64 encoding, please see RFC 1421.
Note
For every 3 characters of 8 bits each in the string-argument, the BASE64 function returns 4 characters of 6 bits each. This means that the resulting string is longer than the string-argument. For example, if the string-argument is 30 characters, the result will be 40 characters.
The numeric-error-argument is a numeric variable with a length and precision of at least 1.0. If the BASE64 function successfully encodes the string-argument, the numeric-error-argument is set to 0. If the conversion is unsuccessful (e.g., if the encoding overflows the string accumulator), it is set to 1.
To de-encode a Base 64 string, use the BASE256 function.
History: This function was added in Build 290.
Example: LENGTH 30 & LOCAL B$
LENGTH 40 & LOCAL A$
LENGTH 1.0 & LOCAL ERR
.
A$ = BASE64(B$,ERR) ! Encode B$
IF ERR = 1 THEN
PRINT (0) "ERROR IN BASE64 ENCODING."
ENDIF