BASE64-ENCODE function
- Last Updated: March 3, 2026
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Converts binary data into a Base64 character
string, and returns a LONGCHAR containing the character data. The
resulting LONGCHAR is in the code page specified by -cpinternal.
Syntax
|
- expression
- A MEMPTR or RAW expression containing the binary data you want to convert.
Note: The
BASE64-ENCODE,
BASE64-DECODE, HEX-ENCODE, and
HEX-DECODE functions do not do any byte ordering. However, the binary
output of these functions may be a binary data type such as a MEMPTR or RAW. If the target
of these operation’s output is another system where the order of bytes (endianness) differs,
you must first normalize the data to what the receiving side is expecting. Otherwise, the
results may not be as expected. For example, for a MEMPTR value that you are building
yourself, you can use the SET-BYTE-ORDER statement to set the byte order for the
MEMPTR variable before you read or write the value.Example
The following example code uses the BASE64-ENCODE
function:
|
Running this code displays the numeric byte values stored in the MEMPTR,
followed by a message showing the Base64‑encoded character string:
|
The following example shows encoded strings, with and without padding characters at the end of them:
|
Running this code produces the following output:
|
|