30 | | If supplementary characters is needed, we have to use utf8mb4 charset. However, max size of column would be short because 1 character requires 4 bytes for index. Since MySQL 5.5.3, utf16 supports supplementary characters using surrogate pair. 1 character in utf16 requires 2 bytes for index. |
| 30 | If supplementary characters is needed, we have to use utf8mb4 charset prior to MySQL 5.5. Since MySQL 5.5, can use utf16/utf32. ~~However, max size of column would be short because 1 character requires 4 bytes for index. Since MySQL 5.5.3, utf16 supports supplementary characters using surrogate pair. 1 character in utf16 requires 2 bytes for index.~~ |
| 31 | |
| 32 | {{{ |
| 33 | mysql> SHOW CHARACTER SET LIKE 'utf%'; |
| 34 | +---------+----------------+--------------------+--------+ |
| 35 | | Charset | Description | Default collation | Maxlen | |
| 36 | +---------+----------------+--------------------+--------+ |
| 37 | | utf8 | UTF-8 Unicode | utf8_general_ci | 3 | |
| 38 | | utf8mb4 | UTF-8 Unicode | utf8mb4_general_ci | 4 | |
| 39 | | utf16 | UTF-16 Unicode | utf16_general_ci | 4 | |
| 40 | | utf32 | UTF-32 Unicode | utf32_general_ci | 4 | |
| 41 | +---------+----------------+--------------------+--------+ |
| 42 | 4 rows in set (0.00 sec) |
| 43 | }}} |