encodebase64(
encodebase64(
DATA
,
WRAPLENGTH
)

The encodebase64( function encodes data using Base64.

Parameters

This function has two parameters:

data – is the data to be encoded. This may be binary data or text. If it is text, it is first converted to binary data using UTF-8 encoding. (If you want to use a different encoding, you can convert the text to binary yourself with the texttobinary( function.)

wraplength – is the maximum line length of the encoded text. A common value is around 70 characters per line. If this parameter is zero there will be no line breaks in the encoded text, however, you should still make sure to manually add a line break at the end of the encoded text. Note: This parameter is optional, if it is left off, a wrap width of 68 is assumed.

Description

This function encodes data using Base64 encoding. Base64 encoding is widely used on the web and in e-mail for encoding binary data and allowing it to be transmitted as text. See Base64 Encoding in Wikipedia for more information.

This example converts a message into Base64 format:

    packet=encodebase64(message)

Later the packet can be converted back into the original data like this:

    original=decodebase64(packet)

If the original value was text, you would need to explicitly convert it back to text after decoding it, as shown below. Note: the final result of this will be a Unicode string.

    original=binarytotext(decodebase64(packet))

See Also

- decodebase64( -- decodes data using Base64.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now the second parameter is optional (defaults to 68 if missing) and the first parameter can be a binary or text value.