This is how base46 function could be implemented.
function b64(input)
{
var convert = host.type("System.Convert");
var encoding = host.type("System.Text.Encoding");
var inputBytes = encoding.UTF8.GetBytes(input);
return convert.ToBase64String(inputBytes);
}