Unichar support

Adaptive Server version 12.5 adds two new datatypes using the UTF-16 encoding of the Unicode character. The new unichar and univarchar datatypes are independent of the existing char and varchar dataypes, but mirror their behavior. Unichar is a fixed-width, non-nullable data type (like char) and univarchar is a variable-width, nullable data type (like varchar). The set of built-in string functions that operate on char and varchar, will also operate on unichar and univarchar.

Note however, that unlike the existing char and varchar, the new unichar and univarchar only store UTF-16 characters and have no connection to the default character set ID or default sort order ID ASE configuration option. To use these new data types, the default character set for the server must be set to UTF-8.

The main advantage of these new datatypes is efficiency. The UTF-16 character types are approximately 33% more space efficient than UTF-8 for Asian characters.

Each unichar/univarchar character requires two bytes of storage; a unichar/univarchar column consists of 16-bit Unicode values. The following command creates a table with one unichar column for 10 Unicode values requiring 20 bytes of storage:

Create table unitbl (unicol unichar (10))

The length of a unchar/univarchar column is limited by the size of a data page in Adaptive Server, just as in char/varchar columns.