Sunday, October 08, 2006

Displaying Chinese characters using utf-8 code

I took the task of building a website for Association of Chinese Scholars and Students in the Netherlands, Enschede, about 2 years ago. The web server is provided by the Student Network of Twente (SNT), University of Twente. As they didn't have the GB2321 installed on the server, I went through a long way to get the Chinese words display correctly on the website. But I didn't record what I did to make it done at that time.
Several weeks ago, I passed the task of building and maintaining the website to another Chinese student in the computer science department. She found that the website she built could not be displayed correctly, and she asked me for help.
The first thing I did is to check whether she added "<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">" in every page that contains Chinese characters.
Then I checked if she put the .htaccess file that contains the following statements:
AddDefaultCharset off
AddType text/html;charset=utf-8 html
That was one problem for her website, because she didn't use this configuration file. (The usage of .htaccess file is available in )
After I correct the above issue, the Chinese characters cannot be displayed, still. Finally I asked how she built the website, and she told me that she just used the DreamWeaver under the WinXP OS (Chinese version, I believe). Suddenly I realized that the files of the website must be stored without using UTF-8 code. I used the notepad to open all the web pages and resaved them using UTF-8 code.
Then, the problem is solved! .

No comments: