Unofficial LSL Reference

[[functions:llbase64tostring]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

This is an old revision of the document!


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, taken as a string encoded in UTF-8, is then converted to a LSL Unicode string.

Parameters

base64str

A string expressed in Base64 that represents the byte string to convert.

Return value

The string that the UTF-8 byte sequence represents.

Notes

  • Invalid UTF-8 characters and NUL characters (U+0000) that are not at the end of the string, are converted to question marks ("?"). If the string ends in a NUL character, it's just stripped.
  • Padding is ignored; parsing proceeds until the first non-Base64 character is found.

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)

See also