Converts a binary variant into a string.
BinaryToString ( expression [, flag] )
Parameters
| expression | An expression to convert into a string. |
| flag | [optional] Changes how the binary data is converted: flag = 1 (default), binary data is taken to be ANSI flag = 2, binary data is taken to be UTF16 Little Endian flag = 3, binary data is taken to be UTF16 Big Endian flag = 4, binary data is taken to be UTF8 |
Return Value
Success: The string representation of the binary data.
Remarks
Unlike String() which returns a hexidecimal representation of binary data, this function will assume the binary data is a string value and convert it appropriately.
Related
Binary, IsBinary, String, StringToBinary
Example
; Binary ANSI to String
$buffer = StringToBinary("Hello - 你好")
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer)
MsgBox(4096, "BinaryToString() ANSI representation" , $buffer)
; Binary UTF16-LE to String
$buffer = StringToBinary("Hello - 你好", 2)
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer, 2)
MsgBox(4096, "BinaryToString() UTF16-LE representation" , $buffer)
; Binary UTF16-BE to String
$buffer = StringToBinary("Hello - 你好", 3)
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer, 3)
MsgBox(4096, "BinaryToString() UTF16-BE representation" , $buffer)
; Binary UTF8 to String
$buffer = StringToBinary("Hello - 你好", 4)
MsgBox(4096, "String() representation" , $buffer)
$buffer = BinaryToString($buffer, 4)
MsgBox(4096, "BinaryToString() UTF8 representation" , $buffer)