Building Chinese Web Sites using PHP
Dr. Herong Yang, Version 2.12

Building Chinese Web Sites using PHP

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

Copyright © 2011 by Dr. Herong Yang. All rights reserved.

HerongYang.com It can be used as a tutorial guide for beginners. Topics include installing PHP and Tomcat; creating PHP pages; displaying pages in Chinese; saving Chinese characters to MySQL database; fetching Chinese characters from MySQL database.

Table of Contents

About This Book

PHP Installation on Windows Systems

Download and Install PHP 5.2.2 on Windows

Running PHP Scripts

Integrating PHP with Apache Web Server

Downloading Apache 2.2.4 Binary for Windows

Installing Apache 2.2.4 on Windows Systems

Publishing HTML Documents as Web Pages

Configuring Apache for PHP CGI Scripts

Publishing PHP Scripts as Web Pages

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

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 Functions

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

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 5.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

php_mysql.dll - Configuring PHP to Use MySQL Module

Commonly Used MySQL Functions

mysql_connect() - Creating MySQL Connections

INSERT INTO - Inserting New Records

SELECT - Running Database Queries

UPDATE - Modifying Database Records

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

Sending Non-ASCII Text to MySQL in Latin1 Encoding

Sending Non-ASCII Text to MySQL in UTF8 Encoding

Sending Non-ASCII Text to MySQL in GBK Encoding

Sending Non-ASCII Text to MySQL in Big5 Encoding

Sending Non-ASCII Text to MySQL in Multiple Encoding

Summary - Sending and Fetching Non-ASCII Text

Retrieving Chinese Text from Database to Web Pages

Steps and Application Components Involved

Fetching ASCII Text from Database to Web

Fetching Chinese Text from Database to Web

Fetching Chinese Text from Database to Web in UTF-8

Fetching Chinese Text from Database to Web in GBK

Fetching Chinese Text from Database to Web in Big5

Summary - Fetching Chinese Text from Database to Web

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

References

PDF Printing Version

Keywords: PHP, Web, Tomcat, Chinese, GB2312, GB18030, Big5, UTF-8, Database, Upload, Input, MySQL

Dr. Herong Yang, updated in 2011
Table of Contents