Using Double-Byte Character Sets on UNIX and Linux

DataDirect Connect and Connect XE for ODBC UNIX and Linux drivers can use double-byte character sets. The drivers normally use the character set defined by the default locale "C" unless explicitly pointed to another character set. The default locale "C" corresponds to the 7-bit US-ASCII character set. Use the following procedure to set the locale to a different character set.

  1. Add the following line at the beginning of applications that use double-byte character sets:
  2. setlocale (LC_ALL, "");

    This is a standard UNIX function. It selects the character set indicated by the environment variable LANG as the one to be used by X/Open compliant, character-handling functions. If this line is not present, or if LANG is not set or is set to NULL, the default locale "C" is used.

  3. Set the LANG environment variable to the appropriate character set. The UNIX command locale -a can be used to display all supported character sets on your system.

For more information, refer to the man pages for "locale" and "setlocale."