Convert Bytes to Text

Verb: bytesToText

Converts a list of bytes to text.

Syntax

bytesToText --bytes(List<Byte>) --convertiontype(Nullable<BytesConvertionType>) --encoding(Nullable<EncodingType>) (Boolean)=success (String)=value

Inputs

Script Designer Required AcceptedTypes Description
--bytes Bytes List Required List<Byte> List of bytes that should be converted.
--convertiontype Conversion Type Required BytesConvertionType Format of the text conversion to be done. Options:
  • Base64
  • Text
  • --encoding Encoding Only whenConversion Type is Text EncodingType Type of encoding that is used in the conversion. Options:
  • ASCII
  • Big Endian Unicode
  • Operating System Default
  • Unicode
  • UTF32
  • UTF7
  • UTF8
  • Outputs

    Script Designer AcceptedTypes Description
    success Success Boolean Returns "True" if the command execution was successful, or "False" otherwise.
    value Text Text List of bytes converted to text.

    Example

    The Convert Bytes to Text command converts a value in bytes to text from the conversion made from text to bytes by the Convert Text to Bytes command. At the end, the Log Message command displays the byte list and the result of the conversion.

    defVar --name text --type String --value "Leader in Automation!"
    defVar --name bytesList --type List --innertype Byte
    defVar --name conversionSuccess --type Boolean
    defVar --name convertedText --type String
    textToBytes --text "${text}" bytesList=value
    logMessage --message "\r\nText written in Bytes:\r\n${bytesList}" --type "Info"
    bytesToText --bytes ${bytesList} --convertiontype "Text" --encoding "Default" conversionSuccess=success text=value
    // Display in the console a list of bytes and text after the list is converted.
    logMessage --message "\r\nText after conversion:\r\n${convertedText}" --type "Info"