Table of Contents

Start Functions Events Constants Types Language Articles

Function: llBase64ToString

string llBase64ToString(string base64str)

Converts a byte sequence containing UTF-8 characters, encoded as a Base64 string, to a string.

That is, the input string is first converted to a Base64-encoded byte sequence. That byte sequence is then interpreted as a string encoded in UTF-8, and converted to a LSL Unicode string.

Parameters

base64str

A string expressed in Base64 that represents the UTF-8 byte sequence to convert.

Return value

The string that the UTF-8 byte sequence represents.

Notes

Short examples

string s;

// The Base64 sequence "4pi6" corresponds to the byte
// sequence E2 98 BA (hex). That byte sequence is the
// UTF-8 code for "☺". Therefore, the following line sets
// s to "☺":
s = llBase64ToString("4pi6"); // sets s to "☺"

s = llBase64ToString(""); // sets s to ""

s = llBase64ToString("SGVsbG8="); // sets s to "Hello"

s = llBase64ToString("SGVsbG8"); // same (padding is ignored)

s = llBase64ToString("AAAA"); // sets s to "??"
// (trailing NUL is stripped; first two NULs are converted to "?")

See also