SysFromUnicode (Windows only)

>>-SysFromUnicode--(--string, codepage, mappingflags,----------->

>--, defaultchar, outstem--)-----------------------------------><

Maps a UNICODE character string to an ASCII character string. The new character string and additional information is returned in the outstem.



A string containing the UNICODE characters to be mapped.


Specifies the code page used to perform the conversion. This parameter can be the value of any code page that is installed or available in the system. The default is the current original equipment manufacturer (OEM) code-page identifier for the system.

You can also specify one of the following values:


ANSI code page.


OEM code page.


Windows 2000: symbol code page.


Windows 2000: current thread's ANSI code page.


Windows NT 4.0 and Windows 2000: translate using UTF-7.


Windows NT 4.0 and Windows 2000: translate using UTF-8. When this is set, mappingflags must be set.


Specifies the handling of unmapped characters. The function performs more quickly when none of these flags is set.

The following flags can be used:


Converts composite characters to precomposed characters.


Generates separate characters during conversion. This is the default conversion behavior.


Discards nonspacing characters during conversion.


Replaces non-convertible characters with the default character during conversion.

When compositecheck is specified, the function converts composite characters to precomposed characters. A composite character consists of a base character and a nonspacing character, each having different character values. A precomposed character has a single character value for a combination of a base and a nonspacing character. In the character è, the "e" is the base character, and the "grave" accent mark is the nonspacing character.

When compositecheck is specified, it can use the last three flags in this list (discardns, sepchars, and defaultchar) to customize the conversion to precomposed characters. These flags determine the function's behavior when there is no precomposed mapping for a combination of a base and a nonspace character in a Unicode character string. These last three flags can be used only if the compositecheck flag is set. The function's default behavior is to generate separate characters (sepchars) for unmapped composite characters.


Character to be used if a Unicode character cannot be represented in the specified code page. If this parameter is NULL, a system default value is used. The function is faster when defaultchar is not used.


The name of the stem variable that will contain the converted result. If the conversion was successful the stem will be composed of the following value(s):


This variable will be set to "1" if the defaultchar was used during the conversion and "0" if it was not.


This variable will contain the converted string.

Return codes:


No errors.


An error occurred. A Windows System Error code is returned. This may be one of the following, but could be others.


Incorrect code page or codepage value.


Invalid mapping flags.