Command SET CHARSET Foundation
Selects the default character set
SET CHARSET TO ansi | OEM
The command selects the character set to be used for character values by the Xbase++ runtime libraries. OEM and ANSI character sets differ especially for country-specific special characters, such as German umlauts, for example. The default character set depends on the operating system and the application type. For example, OS/2 and DOS use an OEM character set, while Windows uses an ANSI character set for GUI applications and an OEM character set for text mode applications.
Automatic ANSI-OEM conversion under Windows
Text data can be stored in a database file using an OEM character set, but a Windows GUI application displays data always with an ANSI character set. To ensure a correct display in both text mode and GUI applications, Xbase++ provides for an automatic ANSI-OEM conversion between database file, runtime library and display. The automatic conversion covers eight different situations which depend on the DatabaseEngine, the application type and the SET CHARSET setting.
The default character set (OEM) and DatabaseEngine (DBFNTX) ensure that data created with DOS Clipper applications is processed with no conversion if the application runs in text mode (figure A). The required conversion to the ANSI character set is achieved by linking the program as a GUI application, not by changing the SET CHARSET setting.
When the ANSI character set is selected, data created on Windows platforms is processed with no conversion if a DatabaseEngine is used that supports the ANSI character set (figure D).
Refer to Specifications of the DatabaseEnginesfor information on how the SET CHARSET setting is treated by the different DatabaseEngines.
Multi-threading issues
The SET CHARSET setting has thread-local scope which means that character strings are manipulated in memory according to the setting of the current thread. If strings are displayed on screen, however, the SET CHARSET setting of the main thread is taken. It is not possible to display strings in two windows having different SET CHARSET settings. If two threads use different character sets and display strings, the strings must be converted either with ConvToAnsiCP() or ConvToOemCP() according to the character set used in the main thread before they are displayed.
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.