CharsetEncode
Encodes a binary string representation to an encoded string
Method Signature
CharsetEncode(binary=[byte[]], encoding=[string])
Arguments
Argument
Type
Required
Description
Default
binary
byte[]
true
The binary data to encode to a string
encoding
string
false
The charset encoding to use (default: utf-8 )
utf-8
Examples
Encode a string using utf-8 back into binary encoding of the string
Use charsetEncode to Encode with utf-8
s = charsetDecode( "string", "utf-8" );
charsetEncode( s, "utf-8" );
Result: string
Encode a string using us-ascii back into binary encoding of the string
Use charsetEncode to Encode with us-ascii
s = charsetDecode( "string", "us-ascii" );
charsetEncode( s, "us-ascii" );
Result: string
Additional Examples
decoded = CharsetDecode( "I am a string.", "utf-8" );
dump( CharsetEncode( decoded, "utf-8" ) );
// "I am a string"
Related
Last updated
Was this helpful?