phpgrailsresinquercus

Quercus PHP Grails Character Encoding Issue


I am successfully using the latest resin jar (from http://www.caucho.com/download/) to allow me to utilize legacy PHP code within my Grails web application. Everything renders great, EXCEPT non-ASCII character sets.

These characters show up as question marks, and looks like this: ???? ?? ???.

I've tried numerous solutions:

From setting php.ini to be utf8, to making sure extension=php_mbstring.dll is included in php.ini. I have also ensured that the MySQL database is configured to do utf-8. The characters stored in the database show up correctly in phpMyAdmin.
Also, I am able to do a die("BLAH"), where BLAH is non-ASCII text, and it will output correctly to the browser. My browser shows content header utf-8 on all the pages.

Another kicker is that I am able to take the PHP codebase running within Grails, and run it inside a WAMP server on the SAME machine, connecting to the SAME MySQL database, and it outputs the non-ASCII characters just fine.

My feeling is that it is a data transfer issue from MySQL to the PHP running in Grails (remember, it works from MySQL to the same PHP running in WAMP). In both cases, I am even performing mysql_query("SET NAMES 'utf8'") before running my query.

I have also tried taking the WAMP php.ini file and using it in Grails, and Grails PHP still won't play nice...Part of me thinks that somehow the PHP in Grails isn't reading the php.ini file, and is falling back on some default php.ini (which I don't know about).
For example, if I make the Grails php.ini file an empty file, Grails still starts fine, and I can render php pages. BUT if I set php.ini to garbage text like "asdfasdf", Grails will not start...so that leads me to believe it is seeing the php.ini...

Additional info:

I have tried everything I've found online, but no luck... Thanks for your help!


Solution

  • The next release of Quercus (4.0.36) fixes the long-standing issues with MySQL encodings. See:

    http://forum.caucho.com/showthread.php?p=36255#post36255