10bet网址
MySQL 5.7 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

MySQL 5.7 Reference Manual/.../ The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)

10.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)

Theutf8mb3character set has these characteristics:

  • Supports BMP characters only (no support for supplementary characters)

  • Requires a maximum of three bytes per multibyte character.

Applications that use UTF-8 data but require supplementary character support should useutf8mb4rather thanutf8mb3(seeSection 10.9.1, “The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)”).

Exactly the same set of characters is available inutf8mb3anducs2. That is, they have the samerepertoire.

utf8is an alias forutf8mb3; the character limit is implicit, rather than explicit in the name.

utf8mb3can be used inCHARACTER SETclauses, andutf8mb3_collation_substringinCOLLATEclauses, wherecollation_substringisbin,czech_ci,danish_ci,esperanto_ci,estonian_ci, and so forth. For example:

CREATE TABLE t (s1 CHAR(1) CHARACTER SET utf8mb3; SELECT * FROM t WHERE s1 COLLATE utf8mb3_general_ci = 'x'; DECLARE x VARCHAR(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_danish_ci; SELECT CAST('a' AS CHAR CHARACTER SET utf8) COLLATE utf8_czech_ci;

MySQL immediately converts instances ofutf8mb3in statements toutf8, so in statements such asSHOW CREATE TABLEorSELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLUMNSorSELECT COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS, users see the nameutf8orutf8_collation_substring.

utf8mb3is also valid in contexts other thanCHARACTER SETclauses. For example:

mysqld --character-set-server=utf8mb3
SET NAMES 'utf8mb3'; /* and other SET statements that have similar effect */ SELECT _utf8mb3 'a';

For information about data type storage as it relates to multibyte character sets, seeString Type Storage Requirements.