seems that i cant get chinese characterse from mysql and echo them successfully. I have tried setting encodings to gb2312 and utf8, both dont work. $query = "SELECT * FROM chinese WHERE uid='111111'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); echo $row['word']; PHP: this displays ????????'s been researching all afternoon for the answer. My page encoding is correct, and im displaying chinese characters echo'd normally. echo "<br><br>ç›é€‰ï¼šæŠŠè‘¡è„çš„æžœå®žå’Œè‘¡è„æ¢—分开"; PHP:
Change your Web Browser Language Character set from English to Chinese.... I believe your browser is seeing the correct characters, but doesn't know to render them using Chinese characters.
no its not, i can see characters fine, however the page doesnt get the correct characters from mysql. As above i did an echo with characters and that displays, however the echo from mysql data displays only ???s
Just a thought, does the collation method in the database make a difference? i.e. is it possible to check that it is actually storing double byte data?
what version of mysql are u running? heres few things u need, set the collumn in the table to "utf-8, general ci" set the ur meta tag to "utf-8" if u gonna work in unicode string make sure php is compiled (on linux) or has (on windows) the mbstring extension im after completeing my latest CMS that runs on php5, mysql5, apache 2 with complete unicode support, came across all these problems, unfortunately php is shite when it comes to unicode (compared to java or c# or nay other decent language), the word on the street is that php6 will have unicode support, but thats years away from popular adoption heck php5 was out for years and no one is using it really
MySQL version 4.1.14-standard PHP version 4.4.2 is this the problem? It is running on an Apache version 1.3.34 (Unix) perhaps this needs to be updated? I've tried with many different sets of encodings, none work. UTF-8 would be ideal since im storing english, french, and chinese in this database. I've heard that about php6 too when i was researching how to use chinese chars. Anyhow i'm using PHP (already have the scripts done to handle the english and french version, just need to finish the chinese part). Basically my encodings are correct i'll talk to the server administrators to see if they can update things.
im not sure if mysql4 fully supports utf-8, u better look into it im using mysql5 on my server, and an excellent program called navicat to manage,create,backup remotely the database (becase phpmyadmin is slow and i had trouble with unicode and that program) i recommend googling for wampserver i use it to develop on my laptop, itll install mysql5, php5 and 4,apache2 and itll let u easily switch between php4 and php5 on ur localhost
oh ok. i have my own servers and had alot of trouble compiling latest php, apache, mysql and php extensions such as mbstring check ur phpinfo file for mbstring extension http://ie2.php.net/mbstring http://dev.mysql.com/doc/refman/4.1/en/charset-unicode.html
oh i think theres a trick u can do if database doesnt support unicode, use htmlentities this will encode all weird characters but u will loose things like unicode searching... this is a very grey area for php mysql unfortunately