Functions and Directives

Function Unicode2Str() Foundation

Convert a Unicode to an ANSI-encoded character string.

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

The function returns a character string in ANSI format.


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.


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.