The encodebase64( function encodes data using Base64.
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 UTF8 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.
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:
Later the packet can be converted back into the original data like this:
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.
|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.|