Chinese Web Sites Using PHP

https://www.herongyang.com/PHP-Chinese

Copyright © 2005-2022 Herong Yang. All rights reserved.

Chinese Websites This PHP tutorial book is a collection of tutorial notes and sample codes on building Chinese Web sites with PHP scripts and MySQL Server. The concepts presented can also be applied to other server side scripting languages and database servers. Topics include installing PHP, Apache Web Server and MySQL server; Creating dynamic Web pages with PHP scripts; Connecting to MySQL Server from PHP scripts; Creating database columns with different Chinese character sets/encodings; Transferring Chinese text from and to database in specific encoding; Displaying Chinese text in Web pages; Collecting Chinese text in Web input forms. Updated in 2022 (Version v2.23): Updated with PHP 7 and minor changes.

Table of Contents

About This Book

PHP Installation on Windows Systems

Download and Install PHP 7.3.0 on Windows

Running PHP Scripts

Integrating PHP with Apache Web Server

Downloading Apache 2.4.37 Binary for Windows

Installing Apache 2.4.37 on Windows Systems

Publishing HTML Documents as Web Pages

Configuring Apache for PHP CGI Scripts

Publishing PHP Scripts as Web Pages

Permission Error on php-cgi.exe

charset="*" - Encodings on Chinese Web Pages

Chinese Character Set Encoding Options

HTML Document Travel Path

Chinese Web Pages with UTF-8 Encoding

Chinese Web Pages with GB18030 Encoding

Chinese Web Pages with Big5 Encoding

UTF-8 Encoding Pages with GB18030 Characters

Chinese Characters in PHP String Literals

String Data Type, Literals and Functions

String Literal Travel Path

Chinese Character String with UTF-8 Encoding

Chinese Character String with GB18030 Encoding Error

Chinese Character String with GB18030 Encoding

Chinese Character String with Big5 Encoding

UTF-8 Encoding Pages with Big5 Characters

Multibyte String Functions in UTF-8 Encoding

php_mbstring.dll - Multibyte String Extension

mb_strlen() - Counting Multibyte Characters

List of Multibyte String Functions

Input Text Data from Web Forms

Steps and Components Involved

Processing Web Form Input in ASCII

Processing Web Form Input in Latin1 Encoding Error

Processing Web Form Input in Latin1

Entering Latin1 Characters with Alt Keycodes

Testing Latin1 Alt Keycodes with IE

Processing Web Form Input in UTF-8

Outputting Form Default Input Text in UTF-8

Testing Alt Keycodes with IE on a UTF-8 Web Page

Input Chinese Text Data from Web Forms

Steps and Components Involved

Processing Chinese Input on Web Forms in UTF-8

Processing Chinese Input on Web Forms in GB18030

Processing Chinese Input on Web Forms in Big5

Copying and Pasting Chinese Input to UTF-8 Web Forms

Copying and Pasting Chinese Input to GB18030 Web Forms

Copying and Pasting Chinese Input to Big5 Web Forms

MySQL - Installation on Windows

MySQL 8.0 Download, Installation and Start

mysqladmin - MySQL Admin Tool

mysql - Command Line Tool

Creating Database and User with MySQL Monitor

Creating a Test Table - Comment

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 Encoding Issue Example

MySQL - Sending Non-ASCII Text to MySQL

Retrieving Chinese Text from Database to Web Pages

Input Chinese Text Data to MySQL Database

Steps and Application Components Involved

Inputting Chinese Text to MySQL Database in UTF-8

Inputting Chinese Text to MySQL Database in GBK

Inputting Chinese Text to MySQL Database in Big5

Summary

Chinese Text Encoding Conversion and Corruptions

Detect System Default Encoding

Root Cause of Corrupted Chinese Text

Corrupted Chinese File Name with Un-ZIP

Generate 8-Bit Encoding Tables

Restore Corrupted Chinese Text

Encoding-Convertor.php - Encoding Conversion Test

Archived Tutorials

Archived: Download and Install PHP 5.2.2 on Windows

Archived: Downloading Apache 2.2.4 Binary for Windows

Archived: Installing Apache 2.2.4 on Windows Systems

Archived: MySQL 5.0 Download, Installation and Start

Archived: php_mysql.dll - Configuring PHP to Use MySQL Extension

Archived: Commonly Used php_mysql.dll Functions

Archived: mysql_connect() - Creating MySQL Connections

Archived: Character Set Variables on MySQL 5

Archived: Non-ASCII Test Analysis on MySQL 5

Archived: Fetching Non-ASCII Text from MySQL 5

Archived: Sending Text in Latin1 Encoding to MySQL 5

Archived: Sending Text in UTF8 Encoding to MySQL 5

References

Full Version in PDF/EPUB

Keywords: PHP, Web, Chinese, Character Set, Encoding, GB2312, GB18030, Big5, UTF-8, MySQL, Apache