Discussion:
chinese chars OK in phpmyadmin but ??? on regular php page
(too old to reply)
L***@gmail.com
2007-02-12 14:52:40 UTC
Permalink
I have mysql 5 and php 5.1.2 with chinese chars in utf8 on mysql.
Browsing the tables in phpmyadmin shows correct chinese characters.
However, a custom php page to display them shows only ???

At the top of my php page I did include:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Any help?

Thanks!
L***@gmail.com
2007-02-12 22:11:09 UTC
Permalink
try

http://forums.devshed.com/php-development-5/utf-8-problems-mysql-and-php-401164.html?&highlight=php+utf-8+mysql

basically change:

<?php

mysql_connect ( 'localhost', 'user', 'pass' );
mysql_select_db ( 'my_database' );

// continue script...

?>

to

<?php

mysql_connect ( 'localhost', 'user', 'pass' );
mysql_select_db ( 'my_database' );

// set utf8 unicode mode

mysql_query ( 'SET NAMES utf8' );

// continue script...

?>
Post by L***@gmail.com
I have mysql 5 and php 5.1.2 with chinese chars in utf8 on mysql.
Browsing the tables in phpmyadmin shows correct chinese characters.
However, a custom php page to display them shows only ???
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Any help?
Thanks!
Loading...