Building Chinese Web Sites using PHP
∟MySQL - Character Set and Encoding
∟Checking Character Set Setting
This section describes how to check the character set settings of text column in MySQL server.
After created my test table, I used the following SQL Monitor commands to check what character sets are defined for each text column in the table:
C:\>\local\mysql\bin\mysql -u herong -pTopSecret mysql> USE HerongDB; Database changed mysql> SHOW CREATE DATABASE HerongDB; +----------+------------------------------------------- | Database | Create Database +----------+------------------------------------------- | herongdb | CREATE DATABASE `herongdb` /*!40100 DEFAULT CHARACTER SET latin1 */ +----------+------------------------------------------- mysql> SHOW CREATE TABLE Comment_Mixed; +---------------+-------------------------------------- | Table | Create Table +---------------+---------------------------------------------- | Comment_Mixed | CREATE TABLE `comment_mixed` ( `Test_Name` varchar(256) default NULL, `String_ASCII` varchar(256) character set ascii default NULL, `String_Latin1` varchar(256) default NULL, `String_UTF8` varchar(256) character set utf8 default NULL, `String_GBK` varchar(256) character set gbk default NULL, `String_Big5` varchar(256) character set big5 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 | +---------------+----------------------------------------------
Here is what I learned from the output:
Table of Contents
About This Book
PHP Installation on Windows Systems
Integrating PHP with Apache Web Server
charset="*" - Encodings on Chinese Web Pages
Chinese Characters in PHP String Literals
Multibyte String Functions in UTF-8 Encoding
Input Text Data from Web Forms
Input Chinese Text Data from Web Forms
MySQL - Installation on Windows
MySQL - Connecting PHP to Database
►MySQL - Character Set and Encoding
Specifying Character Set for Text Columns
Creating a Table with Multiple Character Sets
►Checking Character Set Setting
Storing ASCII Characters in Non-ASCII Columns
Storing Non-ASCII Characters with Encoded Bytes
Transmitting Non-ASCII Characters between PHP and MySQL
Viewing Character Set Variables
Non-ASCII Test Result Analysis
Fetching Non-ASCII Text from MySQL
MySQL - Sending Non-ASCII Text to MySQL
Retrieving Chinese Text from Database to Web Pages
Input Chinese Text Data to MySQL Database
References
PDF Printing Version