Try OpenEdge Now
skip to main content
Internationalizing Applications
Using Unicode : Unicode support for supplementary characters : Using UTF-16 in the ASC and CHR functions
 

Using UTF-16 in the ASC and CHR functions

To use UTF-16 in the ASC function, use the following syntax:

Syntax

ASC( ch, "UTF-16" [, source-cp ] )
ch
One character, like 'A', "A", or '~U034e'.
source-cp
The name of the source code page.
This returns one of the following values, which are platform independent:
*An integer less than 65536, representing the Unicode scalar value in plane 0
*A long integer composed of the high surrogate in the high-order 16 bits of the int and the low surrogate in the low-order 16 bits of the int
To use UTF-16 in the CHR function, use the following syntax:

Syntax

CHR( n, target-cp, "UTF-16" )
n
The numeric value of the character.
target-cp
The name of the target code page.
This command interprets its input as one of the following platform-independent values:
*The Unicode scalar value for plane 0
*An integer composed of a high surrogate in the high-order 16 bits and the low-surrogate in the low order 16 bits
When using UTF-16 in CODEPAGE-CONVERT, the behavior of character strings as UTF-16 are sensitive to byte order and the presence of null bytes. ABL can handle UTF-16 strings as RAW or MEMPTR data, and the use of PUT-UNSIGNED-SHORT and GET-UNSIGNED-SHORT solves any byte order machine dependencies.