"Sputnik" help  
Sputnik Help
BinaryToStr(<binary>, [<type>])

Description

Converts a binary string to a string representation using the specified encoding type.

Encoding Types:

UTF7: Converts the string to a binary string using the UTF-7 encoding.
UTF8: Converts the string to a binary string using the UTF-8 encoding.
UTF16: Converts the string to a binary string using the UTF-16 encoding (Little-Endian).
UTF16B: Converts the string to a binary string using the UTF-16 encoding (Big-Endian).
UTF32: Converts the string to a binary string using the UTF-32 encoding.
SPK: Converts the string to a binary string using the same encoding that Sputnik used (UTF-8).
RAW: Treats each character in the string as a single byte (1 character = 1 byte).
ASCII: Converts the string to a binary string using the ASCII encoding.

Parameters

<binary> The binary string to be converted.
<type> The encoding type to be used for conversion. Valid types are "UTF7", "UTF8", "UTF16", "UTF16B", "UTF32", "SPK", "RAW", "ASCII", or "HEX". (Default: "RAW")

Return Value

Success: Returns a string representation of the binary data based on the specified encoding type.
Failure: Returns string.

Remarks

The BinaryToStr function provides a convenient way to convert binary data into a readable string format. It supports various encoding types such as UTF-8, UTF-16, ASCII, and more. The RAW type treats each character in the binary string as a single byte, while the SPK type uses the same encoding that Sputnik uses (UTF-8). This function is useful when dealing with binary data that needs to be displayed or processed as a string.

Related

BinaryFromStr

Example

Example of usage:

my $a = (Binary)"Hello World!";
say BinaryToStr($a, "RAW");
printr BinaryFromStr("Cat", "RAW");
// Hello World!
// Binary
// (
//     [0] => 0x43 [67] (C)
//     [1] => 0x61 [97] (a)
//     [2] => 0x74 [116] (t)
// )

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org