Chapter 10 Character Sets, Collations, Unicode第10章 字符集、排序规则、Unicode

Table of Contents

10.1 Character Sets and Collations in General字符集和排序规则概述
10.2 Character Sets and Collations in MySQLMySQL中的字符集和排序规则
10.2.1 Character Set Repertoire字符集汇辑
10.2.2 UTF-8 for MetadataUTF-8用于元数据
10.3 Specifying Character Sets and Collations指定字符集和排序规则
10.3.1 Collation Naming Conventions排序规则命名约定
10.3.2 Server Character Set and Collation服务器字符集和排序规则
10.3.3 Database Character Set and Collation数据库字符集与排序
10.3.4 Table Character Set and Collation表格字符集和排序规则
10.3.5 Column Character Set and Collation列字符集和排序规则
10.3.6 Character String Literal Character Set and Collation字符串文字字符集和排序规则
10.3.7 The National Character Set民族特征集
10.3.8 Character Set Introducers字符集介绍人
10.3.9 Examples of Character Set and Collation Assignment字符集和排序规则分配示例
10.3.10 Compatibility with Other DBMSs与其他DBMS的兼容性
10.4 Connection Character Sets and Collations连接字符集和排序规则
10.5 Configuring Application Character Set and Collation配置应用程序字符集和排序规则
10.6 Error Message Character Set错误消息字符集
10.7 Column Character Set Conversion列字符集转换
10.8 Collation Issues排序规则问题
10.8.1 Using COLLATE in SQL Statements在SQL语句中使用COLLATE
10.8.2 COLLATE Clause PrecedenceCOLLATE子句优先权
10.8.3 Character Set and Collation Compatibility字符集和排序规则兼容性
10.8.4 Collation Coercibility in Expressions表达式中的排序强制性
10.8.5 The binary Collation Compared to _bin Collations二进制排序规则与_bin排序规则的比较
10.8.6 Examples of the Effect of Collation校勘效果示例
10.8.7 Using Collation in INFORMATION_SCHEMA Searches在INFORMATION_SCHEMA搜索中使用排序规则
10.9 Unicode SupportUnicode支持
10.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)utf8mb4字符集(4字节UTF-8 Unicode编码)
10.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)utf8mb3字符集(3字节UTF-8 Unicode编码)
10.9.3 The utf8 Character Set (Alias for utf8mb3)utf8字符集(utf8mb3的别名)
10.9.4 The ucs2 Character Set (UCS-2 Unicode Encoding)ucs2字符集(UCS-2 Unicode编码)
10.9.5 The utf16 Character Set (UTF-16 Unicode Encoding)utf16字符集(UTF-16 Unicode编码)
10.9.6 The utf16le Character Set (UTF-16LE Unicode Encoding)utf16le字符集(UTF-16LE Unicode编码)
10.9.7 The utf32 Character Set (UTF-32 Unicode Encoding)utf32字符集(UTF-32 Unicode编码)
10.9.8 Converting Between 3-Byte and 4-Byte Unicode Character Sets在3字节和4字节Unicode字符集之间转换
10.10 Supported Character Sets and Collations支持的字符集和排序规则
10.10.1 Unicode Character SetsUnicode字符集
10.10.2 West European Character Sets西欧字符集
10.10.3 Central European Character Sets中欧字符集
10.10.4 South European and Middle East Character Sets南欧和中东字符集
10.10.5 Baltic Character Sets波罗的海字符集
10.10.6 Cyrillic Character Sets西里尔文字符集
10.10.7 Asian Character Sets亚洲字符集
10.10.8 The Binary Character Set二进制字符集
10.11 Restrictions on Character Sets对字符集的限制
10.12 Setting the Error Message Language设置错误消息语言
10.13 Adding a Character Set添加字符集
10.13.1 Character Definition Arrays字符定义数组
10.13.2 String Collating Support for Complex Character Sets复杂字符集的字符串排序支持
10.13.3 Multi-Byte Character Support for Complex Character Sets复杂字符集的多字节字符支持
10.14 Adding a Collation to a Character Set向字符集添加排序规则
10.14.1 Collation Implementation Types排序规则实现类型
10.14.2 Choosing a Collation ID选择排序规则ID
10.14.3 Adding a Simple Collation to an 8-Bit Character Set向8位字符集添加简单排序规则
10.14.4 Adding a UCA Collation to a Unicode Character Set向Unicode字符集添加UCA排序规则
10.15 Character Set Configuration字符集配置
10.16 MySQL Server Locale SupportMySQL服务器区域设置支持

MySQL includes character set support that enables you to store data using a variety of character sets and perform comparisons according to a variety of collations. MySQL包括字符集支持,使您能够使用各种字符集存储数据,并根据各种排序规则进行比较。The default MySQL server character set and collation are utf8mb4 and utf8mb4_0900_ai_ci, but you can specify character sets at the server, database, table, column, and string literal levels.默认的MySQL服务器字符集和排序规则是utf8mb4utf8mb4_0900_ai_ci,但您可以在服务器、数据库、表、列和字符串文字级别指定字符集。

This chapter discusses the following topics:本章讨论以下主题:

Character set issues affect not only data storage, but also communication between client programs and the MySQL server. 字符集问题不仅会影响数据存储,还会影响客户端程序和MySQL服务器之间的通信。If you want the client program to communicate with the server using a character set different from the default, you'll need to indicate which one. 如果您希望客户端程序使用不同于默认值的字符集与服务器通信,则需要指明是哪一个字符集。For example, to use the utf8 Unicode character set, issue this statement after connecting to the server:例如,要使用utf8 Unicode字符集,请在连接到服务器后发出以下语句:

SET NAMES 'utf8';

For more information about configuring character sets for application use and character set-related issues in client/server communication, see Section 10.5, “Configuring Application Character Set and Collation”, and Section 10.4, “Connection Character Sets and Collations”.有关为应用程序使用配置字符集以及客户端/服务器通信中与字符集相关的问题的更多信息,请参阅第10.5节,“配置应用程序字符集和排序规则”第10.4节,“连接字符集和排列规则”

10.1 Character Sets and Collations in General
10.2 Character Sets and Collations in MySQL
10.3 Specifying Character Sets and Collations
10.4 Connection Character Sets and Collations
10.5 Configuring Application Character Set and Collation
10.6 Error Message Character Set
10.7 Column Character Set Conversion
10.8 Collation Issues
10.9 Unicode Support
10.10 Supported Character Sets and Collations
10.11 Restrictions on Character Sets
10.12 Setting the Error Message Language
10.13 Adding a Character Set
10.14 Adding a Collation to a Character Set
10.15 Character Set Configuration
10.16 MySQL Server Locale Support