charsetEncode

Uses the specified encoding to convert binary data to a string.

charsetEncode(binaryobject, encoding) → returns binary

charsetEncode Argument Reference

binaryobject binary
Required

A variable containing binary data to decode into text.

encoding string
Required

The character encoding that was used to encode the string into binary format.
Values:
  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16

Examples sample code invoking the charsetEncode function


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');

Expected 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');

Expected Result: string


Fork me on GitHub