- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Marc Delisle
- 300字
- 2021-08-20 15:55:23
Character sets and collations
A character set describes how symbols for a specific language or dialect are encoded. A collation contains rules to compare and sort the characters of a character set. The character set used to store our data may be different from the one used to display it, leading to data discrepancies. Thus, a need to transform the data arises.
Since MySQL 4.1.x, the MySQL server does the character recoding work for us. Also, MySQL enables us to indicate the character set and collation for each database, each table, and even each field. A default character set for a database applies to each of its tables, unless it is overridden at the table level. The same principle applies to every column.
Effective character sets and collations
On the home page, we can see the MySQL charset information and a MySQL connection collation selector. Here is the MySQL charset information:

The character set information (as seen here after MySQL charset) is used to generate HTML information, which tells the browser what is the page's character set.
We can also choose which character set and collation will be used for our connection to the MySQL server using the MySQL connection collation dialog. This is passed to the MySQL server. MySQL then transforms the characters that will be sent to our browser into this character set. MySQL also interprets what it receives from the browser according to the character set information. Remember that all tables and columns have a character set information describing how their data is encoded.

Normally, the default value should work. However, if we are entering some characters using a different character set, we can choose the proper character set in this dialog.
The following parameter defines both the default connection collation and character set:
$cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci';
- Effective C#:改善C#代碼的50個有效方法(原書第3版)
- SpringMVC+MyBatis快速開發與項目實戰
- Developing Mobile Web ArcGIS Applications
- Python網絡爬蟲從入門到實踐(第2版)
- VSTO開發入門教程
- 編寫高質量代碼:改善C程序代碼的125個建議
- 青少年信息學競賽
- UI設計全書(全彩)
- CRYENGINE Game Development Blueprints
- Clean Code in C#
- Solutions Architect's Handbook
- Learning Jakarta Struts 1.2: a concise and practical tutorial
- 從零開始學Python大數據與量化交易
- Learning WordPress REST API
- 量子計算機編程:從入門到實踐