Get the App
SLTechnology News&Howtos  ›  Database  › 

Informix character set Settings

Shulou Source: shulou.com Published: 2022-06-01 09:11:37 10月02日 Update

Character is a general term for all kinds of characters and symbols, including national characters, punctuation marks, graphic symbols, numbers, etc. Character set is a collection of multiple characters. There are many kinds of character sets, and the number of characters contained in each character set is different. Common character set names: ASCII character set, GB2312 character set (simplified Chinese), BIG5 character set (traditional Chinese), GB18030 character set (Asian character set), Unicode(common UTF-8) character set, etc.

II. Introduction to informix character directory

The Informix GLS language environment manages naming and internal encoding (hexadecimal encoding) of commonly used character sets. View the GLS character name and encoding table through the server-side file: $InformixDIR/gls/cm3/registry. Examples are as follows:

character set name encoding hexadecimal encoding

8859-1 819 # 0x0333

gb 57357 # 0xe00d

GB2312-80 57357 # 0xe00d

utf8 57372 # 0xe01c

big5 57352 # 0xe008

GB18030-2000 5488 # 0x1570

Different character set names in the GLS environment may correspond to the same character set code, but a character set can only have one code, that is, the character set code is unique.

The supported character sets in the GLS environment are grouped into different directories by language and locale.$ InformixDIR/gls/lc11/language_region/, such as Chinese mainland directory: $InformixDIR/gls/lc11/zh_cn/, there are two files under this directory: 1570.lco e00d.lco, indicating that we can use zh_cn.GB18030-2000 zh_cn.gb zh_cn.GB2312-80 three different names when setting character sets. Here (zh_cn.gb corresponds to the same character set as zh_cn.GB2312-80).

The different character sets in the GLS environment can be converted correctly. See how those character sets can be converted correctly. See the directory $InformixDIR/gls/cv9 for files that specify character sets to be converted to each other. For example, there are two files e01ce00d.cvo and e00de01c.cvo in this directory, indicating that GLS supports character conversion between UTF-8 and GB through these two conversion files.

Third, informix character set settings

Since the character set of the INFORMIX database is valid for the entire instance, the default character set is: en_US.819

Other character sets can be set (only modified during initial database installation) as follows:

Add to Informix environment variables

export DB_LOCALE=zh_cn.GB18030-2000

export CLIENT_LOCALE=zh_cn.GB18030-2000

Reinitialize the database. The new database supports the UTF8 character set.

4. Using JDBC to connect to databases

jdbc:informix-sqli://192.168.1.1:9088/test:INFORMIXSERVER=ifxserver;NEWCODESET=GB18030,GB18030-2000,5488; CLIENT_LOCALE=zh_cn.GB18030-2000;DB_LOCALE=zh_cn.GB18030-2000

V. View database character set

There are two ways:

A.

dbaccess dbname

select site from systables where tabname=' GL_COLLATE'

B.

dbaccess sysmaster

select * from sysdbslocale

Tags: Character character set code directory data database file different name environment two region symbol language Chinese support under commonly used text mode Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Redmi vpn Shulou Information MariaDB