Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Access Module for Sybase CT User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.10 Internationalization and Localization

Sybase supports internationalization through its data types nchar, nvarchar, unichar, and univarchar. Data types nchar and nvarchar are used for storing characters in the National Language Character Set, and data types unichar and univarchar are used for storing data in UTF-16 encoding. For more information, please see the Sybase documentation.


Sybase data types unichar and univarchar are supported in Sybase Adaptive Server 12.5 or higher with Sybase CT Open Client 12.5 or higher.

On the client side, Sybase localizes with the help of six operating system environment variables: LC_CTYPE, LC_COLLATE, LC_TIME, LC_MESSAGE, LC_ALL, and LANG. The values of these environment variables change the way Sybase interprets and converts data and produces error messages.

The first four definitions are taken from the Sybase International Developer's Guide for Open Client/Server.

2.10.1 Prerequisites

There are three prerequisites for using internationalization functionality with the DB Access Module for Sybase CT:

  1. In order to use the Sybase data types unichar and univarchar, the Sybase Adaptive Server character set must be set as UTF-8.


    Sybase data types unichar and univarchar are supported in Sybase Adaptive Server 12.5 or higher with Sybase CT Open Client 12.5 or higher.

  2. When installing the Sybase client, all required locales, localized messages, and character sets must be installed.

  3. Depending on the operating system locale, the values for the environment variables described in Section 2.10 should be specified correctly. These environment variable values and the vendor locale values mentioned in the locales.dat file located in the directory <Sybase home directory>/locales should match. For information on setting up the correct values of the environment variables, please see the Sybase International Developer's Guide for Open Client/Server.

2.10.2 Changing Locales on the Fly

If your application requires more than one locale, you can obtain different database connections with different locale settings using the RWDBSybCtLibEnvironmentHandle APIs, discussed in Section 2.16. With the help of these APIs, you can localize data in different localization formats within the same application.

2.10.3 Data Binding

To fully use the internationalization features supported by Sybase, the Sybase data types nchar and nvarchar are bound to the C++ data type RWDBMBString, and the Sybase data types unichar and univarchar are bound to the C++ data type RWBasicUString.


Sybase data types unichar and univarchar are supported in Sybase Adaptive Server 12.5 or higher with Sybase CT Open Client 12.5 or higher.

While sending data to the server, the Sybase CT Library internationalizes the contents of the data types nchar and nvarchar to convert them to the server encoding, and localizes them while receiving from the server to the client's encoding. Hence, the contents of the nchar and nvarchar data types are dependent on the localization settings.

On the other hand, unichar and univarchar data types always store UTF-16 encoded data. For this reason, their contents are never internationalized or localized. This data is never converted by Sybase CT Library while sending or receiving from the server. While binding to the unichar or univarchar data types, data must be bound as UTF-16 encoded data; therefore, these server data types are bound to the C++ data type RWBasicUString. RWBasicUString is a data type in the Essential Tools Module designed to encapsulate UTF-16 encoded data. The unichar and univarchar data types can also be bound to the C++ data type RWUString provided in the Internationalization Module.

Please see Section 2.3, "Data Types," for more information on data binding.

2.10.4 Limitations

Internationalization functionality for the DB Access Module for Sybase CT carries the following limitations:

  1. The Sybase data types unichar and univarchar are available only on Sybase Adaptive server version 12.5 or higher with Sybase CT Open Client 12.5 or higher.

  2. As per Sybase documentation, in order for unichar and univarchar data types to function correctly, Sybase Adaptive Server must use the character set of UTF-8.

  3. Currently, the DB Access Module for Sybase CT does not support Unicode logins, passwords, or metadata.

2.10.5 RWWString

Sybase does not differentiate between multibyte and wide character strings while inserting or retrieving data from the server. During input binding, RWWString data are converted to RWDBMBString data before binding. In output binding, the data is received as an MBString and then converted to a WString, if required.

RWWStrings should not be used for binding with Sybase data types unichar or univarchar. Even if they contain UTF-16 encoded data, RWWString data is converted to RWDBMBString before binding and hence will no longer bind UTF-16 encoded data.

2.10.6 Date Formats

Date expressions are loaded into the database and extracted from the database in a locale neutral manner. The DB Interface Module properly formats instances of RWDateTime, RWDate, and RWDBDateTime automatically. The application programmer is responsible for formatting these types outside the scope of DB Interface Module API calls.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.