Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
cannot display Chinese characters not because of <meta> jayzhao
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!
welcome to webmasterworld
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
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?
I am also facing the same problem with my Urdu pages.
Have someone good suggestions?
I know the answer now (thanks to a wonderful colleague!). In the folder, create a .htaccess file with this line:
and voila, it works!