charencode()

Read(1669) Label: character set, string, binary,

Description:

Generate the binary value of a string according to the character set the latter uses, or vice versa.

Syntax:

charencode(str/rawtext, [charset])

Note:

Character sets the function supports include UTF-8, UTF-16, GBK, GB2312, GB18030, BIG5, UNICODE, UnicodeEscape, ISO8859_1, ASCII, EUC_KR, EUC_JP, ISO-2022-CN-GB, ISO-2022-CN-CNS, ISO-2022-JP and ISO-2022-KR.

Parameter:

str

A string

rawtest

A binary value

charset

A character set, such as UTF-8 and GB2312; default is the one currently used by the system

Return value:

Binary value/String

Example:

 

A

 

1

>cs="GBK"

Set the character set.

2

=charencode("abc一二三123")

Generate the binary blob data according to the default character set.

3

=charencode("abc一二三123", cs)

Generate a binary value according to GBK.

4

=charencode (A2)

Return the string of binary data according to the default character set.

5

=charencode (A3, cs)

Return the string of binary value according to GBK.