View Full Version : Chinese Character not display from MySQL database to PHP web page

05-10-2011, 03:11 PM
I'm newbie to using Resin with Quercus.

I have written PHP web pages for my web site, data retrieved from MySQL, and will doing some processing to the data by calling Java classes.

I'm using Resin 4.0.15, PHP 5.3.2, MySQL 5.5, and JDK 1.6.0_25.

I have written my database, table, and column in UTF-8 character set.

I have changed to this [default_charset = "utf-8"] in my "php.ini"

In my PHP script web page, when I connect my database, I have added SOME following query before getting the database:

$connection = mysql_connect('localhost', 'root_username', 'root_password');
mysql_query("SET NAMES 'UTF8'");

On my web page, I got " ? " on every chinese character words.
I have modified many places for UTF8 display such as character set in Database for connection, client, result. All failed to display the chinese character.

I need to display my Chinese Character that stored in MySQL database and display them correctly on web page via Resin.
I have trying Apache TOMCAT to read the chinese charaacter and was successed but unfortunately I do not know JSP.
I feel Resin is convenient for me to handle Java with PHP, but too bad that cannot displaying Chinese character on my web page.

Please kindly advise me as soon as possible (ASAP).

05-11-2011, 09:34 PM
See my last post in thread: http://forum.caucho.com/showthread.php?t=4564

use characterSetResult=utf8 in driver url
use "/*!40101 SET NAMES utf8 */" instead of "SET NAMES utf8"
use unicode.semantics=on

05-14-2011, 03:00 AM

Sorry, I don't get from you.

How to setup "1. use characterSetResult=utf8 in driver url " ?

Is it setup like this "mysql_query("/*!40101 SET NAMES 'utf8' */"); " in my PHP script ?

Where to setup "3. use unicode.semantics=on " ?

05-14-2011, 03:15 AM
Hello, hike73
Look at my post http://forum.caucho.com/showpost.php?p=33329&postcount=13

05-14-2011, 05:13 AM
Thanks dicr,

It works fantastically !! It's finally work on displaying any unicode character as I wanted !

Thank you so much !!