Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

cannot display Chinese characters

not because of <meta>



10:42 pm on Jul 16, 2009 (gmt 0)

5+ Year Member

Hi, I'm trying to set up a Chinese web page in my school's server. The page is written in PHP and I did use

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

to make sure that the characters are encoded. I tried it on localhost on my laptop and it works perfectly (the Chinese characters are displayed properly).

The problem is that when I upload the page folder onto the server, the characters cannot be displayed; there are some funny-looking scribbles like this:


but the page works fine.

Does anything know what the problem is? Thank you!


9:49 am on Jul 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

welcome to webmasterworld

some ideas:
create a file with phpinfo() in it and run it. Check HTTP_ACCEPT_CHARSET to verify that server accepts utf-8 (most likely) and/or chinese charsets

are you pulling data from a mysql database? If yes, make sure that your db can accept chinese charsets OR that the data are in chinese chars stored there

- you can force your db to use an encoding with these two lines:
mysql_query("SET character_set_connection=english");
mysql_query("SET character_set_client=english");

Put those (and take a look at mysql manual for those) right below your mysql_select_db() line and use the appropriate charset for you


2:40 pm on Jul 17, 2009 (gmt 0)

5+ Year Member

Thanks for your reply. I have checked the server and it accepts utf-8. I'm not pulling data from mysql database. It's a very short simple survey so I wrote everything in the php page and stored the data in a text file.

Do you know what else could be the reason?


3:34 pm on Jul 17, 2009 (gmt 0)

5+ Year Member

I am also facing the same problem with my Urdu pages.

Have someone good suggestions?


6:45 pm on Jul 17, 2009 (gmt 0)

5+ Year Member

I know the answer now (thanks to a wonderful colleague!). In the folder, create a .htaccess file with this line:

AddDefaultCharset UTF-8

and voila, it works!


Featured Threads

Hot Threads This Week

Hot Threads This Month