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

Steps and Application Components Involved

This section describes steps and application components involved in saving Chinese text into MySQL database through Web forms and retrieved it back to Web pages.

In order to create a Web form to take Chinese input text into MySQL database and retrieve it back to a Web page, you need to understand how a Chinese input text is being created and transferred through various application components to reach MySQL database, retrieved back to a Web page. Here is a simplified diagram that shows the steps and application components involved in this process:

W1. Key Sequences from keyboard
      |
      |- Web browser
      v
W2. HTTP Request
      |
      |- Web server
      v
W3. CGI input
      |
      |- PHP engine
      v
W4. SQL statements
      |
      |- MySQL
      v
W5. Database tables
      |
      |- MySQL
      v
W6. Result sets
      |
      |- PHP engine
      v
W7. CGI output
      |
      |- Web server
      v
W8. HTTP response (HTML document)
      |
      |- Web browser
      v
W9. Chinese characters on the screen

If you decided to use UTF-8 encoding to handle Chinese characters, you need to make sure that all applications mentioned in the above diagram are friendly to UTF-8 encoding. See the following picture:
Inputting Chinese Text to MySQL Database

Sections in This Chapter

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

Dr. Herong Yang, updated in 2007
Steps and Application Components Involved