Encode & Decode Actions
Decode Base64 encoded data to a byte array.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to decode |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
userXML = loadFileAsXML("users/user.dsml")
photoBytes = decodeBase64ToBytes(userXML.photo[0]);
saveToFile("user.jpg", photoBytes)Decode Base64 encoded data to a string.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to decode |
charset | text, expression, variable | character set encoding for converting bytes to characters(default: UTF-8) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
authHeader = {Authorization: "Basic dXNlcm5hbWU6cGFzc3dvcmQ="}
b64Credentials = splitString(authHeader.Authorization, "/\s+/")
textCredentials = decodeBase64ToString(b64Credentials[2], "UTF-8")
splitCredentials = splitString(textCredentials, ":", 2)
username = splitCredentials[0]
password = splitCredentials[1] Decode Ascii Hex encoded data to a byte array.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to decode |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
md5hashBytes = decodeHexToBytes(md5hash)
Decode Ascii Hex encoded data to a string.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to decode |
charset | text, expression, variable | character set encoding for converting bytes to characters(default: UTF-8) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
string = decodeHexToString(hexstring)
Encode a byte array as Base64.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to encode |
breakLines | boolean, expression, variable | break base64 output into lines (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
ldapRecord = getLDAPRecord(ldapConnection,"cn=jdoe,ou=people,o=data","photo") photoBase64 = encodeBytesToBase64(ldapRecord.photo,true)
Encode a byte array as Ascii Hex.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to encode |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
md5hash = encodeBytesToHex(md5hashBytes)
Encode a string as Base64.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to encode |
charset | text, expression, variable | character set encoding for converting characters to bytes(default: UTF-8) |
breakLines | boolean, expression, variable | break base64 output into lines (default: false) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
xml = <foo><bar/></foo> base64XML = encodeStringToBase64(xml.toXMLString()) setRecordFieldValue(record, "someBase64Field", base64XML)
Encode a string as Ascii Hex.
Property | Value | Description |
|---|---|---|
data* | expression, variable | data to encode |
charset | text, expression, variable | character set encoding for converting characters to bytes(default: UTF-8) |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
Example
hex = decodeHexToString(string)