CHARACTER data types

Informix® supports the following character data types:

In Informix, both CHAR/VARCHAR and NCHAR/ NVARCHAR data types can be used to store single-byte or multibyte encoded character strings. The only difference between CHAR/VARCHAR and NCHAR/NVARCHAR is for sorting: N[VAR]CHAR types use the collation order, while [VAR]CHAR types use the byte order. The character set used to store strings in CHAR/VARCHAR/NCHAR/NVARCHAR columns is defined by the DB_LOCALE environment variable. The character set used by applications is defined by the CLIENT_LOCALE environment variable. Informix uses Byte Length Semantics (the size N that you specify in [VAR]CHAR(N) is expressed in bytes, not characters as in some other databases)

Genero db implements the following character types:

String comparison semantics are equivalent in Informix and Genero db:

In Genero db, CHAR and VARCHAR types store data in single byte or in UTF-8 character sets. For CHAR and VARCHAR, the size is specified in the number of bytes, like Informix.

Note: The character set used to store data for these types is defined by a database configuration parameter called CHARACTER_SET; this parameter must be defined before starting the server for the first time and cannot be changed later on.

Automatic character set conversion between the Genero db client and server is supported. You must properly specify the client character set for Genero db, this is done with an ODBC configuration parameter called characterset.

Solution

The CHAR(n) and VARCHAR(n) types are equivalent in Informix and Genero db. NCHAR(n)/NVARCHAR(n) can also be used as is. Note that, unlike Informix, the collating order (sort) in Genero db will be the same for NCHAR/NVARCHAR as for CHAR/VARCHAR.

Since both databases use Byte Length Semantics, you can use the same size to define [VAR]CHAR columns in both environments.

Do not forget to properly define the client character set, which must correspond to the runtime system character set (LANG/LC_ALL).

See also the section about Localization.