Functions and Directives

Function Unicode2Str() Foundation

Convert a Unicode to an ANSI-encoded character string.

Syntax
Unicode2Str( <cuString> ) --> cString
Parameters
<cuString>
<cuString> is a character string in Unicode format.
Return

The function returns a character string in ANSI format.

Description

The function Unicode2Str() converts a Unicode character string to ANSI format. The ANSI format is the default format for character strings in Xbase++. The primary usage of Unicode2Str() is in conjunction with the native platform API.

The format of the ANSI string returned by Unicode2Str() depends on the current setting of the SET CHARSET setting. If the application is run in OEM mode (SET CHARSET TO OEM, the default), the string returned is OEM-encoded. See the SET CHARSETcommand for more information on character encoding and the string format used in Xbase++.

Windows uses Little Endian UTF-16 encoding for Unicode character strings. Unicode2Str() returns an empty string ("") if <cuString>contains a string with an incorrect encoding. For example, character strings using UTF-8 encoding or Big Endian byte-ordering cannot be converted using the Unicode2Str() function.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.