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:\herong> \local\mysql\bin\mysql -u Herong -pTopSecret

mysql> USE HerongDB;
Database changed

| Database | Create Database
| HerongDB | CREATE DATABASE `HerongDB` 
   /*!40100 DEFAULT CHARACTER SET utf8mb4 
     COLLATE utf8mb4_0900_ai_ci */ |

mysql> SHOW CREATE TABLE Comment_Mixed;
| Table         | Create Table
| Comment_Mixed | CREATE TABLE `comment_mixed` (
  `Test_Name` varchar(356) DEFAULT NULL,
  `String_ASCII` varchar(256) CHARACTER SET ascii 
     COLLATE ascii_general_ci DEFAULT NULL,
  `String_Latin1` varchar(256) CHARACTER SET latin1 
     COLLATE latin1_swedish_ci DEFAULT NULL,
  `String_UTF8` varchar(256) CHARACTER SET utf8 
     COLLATE utf8_general_ci DEFAULT NULL,
  `String_GBK` varchar(256) CHARACTER SET gbk 
     COLLATE gbk_chinese_ci DEFAULT NULL,
  `String_Big5` varchar(256) CHARACTER SET big5 
     COLLATE big5_chinese_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |

Here is what I learned from the output:

Last update: 2019.

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

 Archived Tutorials


 Full Version in PDF/EPUB