Skip to content

qie.base64DecodeToBytes

Signature: qie.base64DecodeToBytes(input)

Returns: byte[] decodedBytes - the decoded byte array

Decode the Base64 encoded input value to a byte array.

Parameters

Type Name Description Default
String input the Base64 encoded value

Example

var xmlMessage = '' +
   '<?xml version="1.0" encoding="GB2312"?>' +
   '<message>' +
   '    <prologue>奇怪的中文编码: 这是一段包含奇怪编码的 XML 内容!</prologue>' +
   '    <greeting>Hello, world!</greeting>' +
   '    <sentiment>Love and kindness are what make life beautiful. ❤️</sentiment>' +
   '    <emoji>😊</emoji>' +
   '    <footer>Stay happy and spread joy!</footer>' +
   '</message>';
var encoded = qie.base64Encode(xmlMessage, 'GB2312');
var rawByteArray = qie.base64DecodeToBytes(encoded);             // byte[]
var decodedValue = new java.lang.String(rawByteArray, 'GB2312'); // will match the original xmlMessage