Updated on 2024-05-31 GMT+08:00

Character Sets

GaussDB allows you to specify the following character sets for databases, schemas, tables, or columns.

Table 1 Character sets

No.

MySQL

GaussDB

1

utf8mb4

Supported

2

utf8

Supported

3

gbk

Supported

4

gb18030

Supported

5

binary

Supported

  • utf8 and utf8mb4 refer to the same character set in GaussDB. The maximum code length is 4 bytes. As a result, if the current character set is utf8 and the collation is set to utf8mb4_bin, utf8mb4_general_ci, utf8mb4_unicode_ci, or utf8mb4_0900_ai_ci (for example, by running select _utf8'a' collate utf8mb4_bin), MySQL reports an error but GaussDB does not report an error. The difference also exists when the character set is utf8mb4 and the collation is set to utf8_bin, utf8_general_ci, or utf8_unicode_ci.
  • The lexical syntax is parsed based on byte streams. If a multi-byte character contains code that is consistent with symbols such as '\', '\'', and '\\', the behavior of the multi-byte character is inconsistent with that in MySQL. In this case, you are advised to disable the escape character function temporarily.