Re: [Resin-interest] Quercus mysql multibyte character-set problem
Hi Scott, I've found this bug fixed, thanks. Was it included in the nearest snapshot? -Wesley - Original Message - From: Scott Ferguson [EMAIL PROTECTED] To: General Discussion for the Resin application server resin-interest@caucho.com Sent: Monday, May 19, 2008 11:09 PM Subject: Re: [Resin-interest] Quercus mysql multibyte character-set problem On May 17, 2008, at 12:44 AM, wesley wrote: PHP function mysql_query mysql_fetch_x cannot handle myltibyte column data. I've test for resin version 3.1.5/3.1.6 and 3.2.0 snapshot, also mysql 4.1.22/5.0.51b/5.1.23rc/6.0.4/alpha as well as mysql-connector- java-3.1.14/5.1.x. This issue can be reproduced in every combination. Thanks. I've filed this as http://bugs.caucho.com/view.php?id=2676. The solution may be a bit tricky because the JDBC driver normally handles i18n in Java, while PHP normally just deals with the unencoded bytes. Have you checked the behavior with unicode.semantics=on? (i.e. PHP 6 mode). If that's enabled, then Quercus strings are 16-bit like Java, not 8-bit like PHP 5. That may be more compatible with the JDBC driver (and really is the right direction moving forward.) -- Scott Test case: test.php ?PHP //$db = mysql_connect(java:comp/env/jdbc/discuz); // not ok either $db = mysqli_connect('127.0.0.1', 'root', 'password', 'test'); mysqli_query($db, 'SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;'); $query = mysqli_query($db, 'SELECT * FROM test'); while($test = mysqli_fetch_assoc($query)) { echo $test['name'].\n; } $db = mysql_connect('localhost', 'root', 'password'); mysql_query('SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;', $db); mysql_select_db('test', $db); $query = mysql_query('SELECT * FROM test', $db); while($test = mysql_fetch_array($query, MYSQL_ASSOC)) { echo $test['name'].\n; } ? = Output should be: 你好 我好 你好 我好 Output now was: `} } `} } =resin-web.xml=== web-app xmlns=http://caucho.com/ns/resin; database jndi-namejdbc/discuz/jndi-name driver type=com.mysql.jdbc.Driver urljdbc:mysql://localhost:3306/test? useUnicode=trueamp;characterEncoding=UTF-8/url !-- not ok either urljdbc:mysql://localhost:3306/test/url -- userroot/user passwordpassword/password init-param characterEncoding=UTF-8 / init-param useUnicode=true / /driver max-connections200/max-connections /database servlet-mapping url-pattern=*.php servlet- class=com.caucho.quercus.servlet.QuercusServlet init databasejava:comp/env/jdbc/discuz/database script-encodingUTF-8/script-encoding compilefalse/compile php-ini unicode.runtime_encodingUTF-8/unicode.runtime_encoding unicode.output_encodingUTF-8/unicode.output_encoding /php-ini /init /servlet-mapping welcome-file-list welcome-fileindex.php/welcome-file /welcome-file-list /web-app = mysql db script=== -- MySQL dump 10.13 Distrib 5.1.24-rc, for Win32 (ia32) -- -- Host: localhostDatabase: test -- -- -- Server version 5.1.24-rc-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `test` -- DROP TABLE IF EXISTS `test`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `test` ( `name` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `test` -- LOCK TABLES `test` WRITE; /*!4 ALTER TABLE `test` DISABLE KEYS */; INSERT INTO `test` VALUES (0xe4bda0e5a5bd); INSERT INTO `test` VALUES (0xe68891e5a5bd); /*!4 ALTER TABLE `test` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40014 SET [EMAIL PROTECTED] */; /*!40014 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40111 SET [EMAIL PROTECTED] */; -- Dump completed on 2008-05-17 6:35:33 = -Wesley ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
Re: [Resin-interest] Quercus mysql multibyte character-set problem
On Jun 16, 2008, at 10:09 AM, wesley wrote: Hi Scott, I've found this bug fixed, thanks. Was it included in the nearest snapshot? Yes, it's included. Please let us know if there are still problems. i18n is tricky to get right. In this situation, there's the i18n of mysql server, the mysql driver, PHP, and Resin itself. -- Scott -Wesley - Original Message - From: Scott Ferguson [EMAIL PROTECTED] To: General Discussion for the Resin application server resin-interest@caucho.com Sent: Monday, May 19, 2008 11:09 PM Subject: Re: [Resin-interest] Quercus mysql multibyte character-set problem On May 17, 2008, at 12:44 AM, wesley wrote: PHP function mysql_query mysql_fetch_x cannot handle myltibyte column data. I've test for resin version 3.1.5/3.1.6 and 3.2.0 snapshot, also mysql 4.1.22/5.0.51b/5.1.23rc/6.0.4/alpha as well as mysql-connector- java-3.1.14/5.1.x. This issue can be reproduced in every combination. Thanks. I've filed this as http://bugs.caucho.com/view.php?id=2676. The solution may be a bit tricky because the JDBC driver normally handles i18n in Java, while PHP normally just deals with the unencoded bytes. Have you checked the behavior with unicode.semantics=on? (i.e. PHP 6 mode). If that's enabled, then Quercus strings are 16-bit like Java, not 8-bit like PHP 5. That may be more compatible with the JDBC driver (and really is the right direction moving forward.) -- Scott Test case: test.php ?PHP //$db = mysql_connect(java:comp/env/jdbc/discuz); // not ok either $db = mysqli_connect('127.0.0.1', 'root', 'password', 'test'); mysqli_query($db, 'SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;'); $query = mysqli_query($db, 'SELECT * FROM test'); while($test = mysqli_fetch_assoc($query)) { echo $test['name'].\n; } $db = mysql_connect('localhost', 'root', 'password'); mysql_query('SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;', $db); mysql_select_db('test', $db); $query = mysql_query('SELECT * FROM test', $db); while($test = mysql_fetch_array($query, MYSQL_ASSOC)) { echo $test['name'].\n; } ? = Output should be: 你好 我好 你好 我好 Output now was: `} } `} } =resin-web.xml=== web-app xmlns=http://caucho.com/ns/resin; database jndi-namejdbc/discuz/jndi-name driver type=com.mysql.jdbc.Driver urljdbc:mysql://localhost:3306/test? useUnicode=trueamp;characterEncoding=UTF-8/url !-- not ok either urljdbc:mysql://localhost:3306/test/url -- userroot/user passwordpassword/password init-param characterEncoding=UTF-8 / init-param useUnicode=true / /driver max-connections200/max-connections /database servlet-mapping url-pattern=*.php servlet- class=com.caucho.quercus.servlet.QuercusServlet init databasejava:comp/env/jdbc/discuz/database script-encodingUTF-8/script-encoding compilefalse/compile php-ini unicode.runtime_encodingUTF-8/unicode.runtime_encoding unicode.output_encodingUTF-8/unicode.output_encoding /php-ini /init /servlet-mapping welcome-file-list welcome-fileindex.php/welcome-file /welcome-file-list /web-app = mysql db script=== -- MySQL dump 10.13 Distrib 5.1.24-rc, for Win32 (ia32) -- -- Host: localhostDatabase: test -- -- -- Server version 5.1.24-rc-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `test` -- DROP TABLE IF EXISTS `test`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `test` ( `name` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `test` -- LOCK TABLES `test` WRITE; /*!4 ALTER TABLE `test` DISABLE KEYS */; INSERT INTO `test` VALUES (0xe4bda0e5a5bd); INSERT INTO `test` VALUES (0xe68891e5a5bd); /*!4 ALTER TABLE `test` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40014 SET [EMAIL PROTECTED] */; /*!40014 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40111 SET [EMAIL PROTECTED] */; -- Dump completed on 2008-05-17 6:35:33 = -Wesley
Re: [Resin-interest] Quercus mysql multibyte character-set problem
On May 17, 2008, at 12:44 AM, wesley wrote: PHP function mysql_query mysql_fetch_x cannot handle myltibyte column data. I've test for resin version 3.1.5/3.1.6 and 3.2.0 snapshot, also mysql 4.1.22/5.0.51b/5.1.23rc/6.0.4/alpha as well as mysql-connector- java-3.1.14/5.1.x. This issue can be reproduced in every combination. Thanks. I've filed this as http://bugs.caucho.com/view.php?id=2676. The solution may be a bit tricky because the JDBC driver normally handles i18n in Java, while PHP normally just deals with the unencoded bytes. Have you checked the behavior with unicode.semantics=on? (i.e. PHP 6 mode). If that's enabled, then Quercus strings are 16-bit like Java, not 8-bit like PHP 5. That may be more compatible with the JDBC driver (and really is the right direction moving forward.) -- Scott Test case: test.php ?PHP //$db = mysql_connect(java:comp/env/jdbc/discuz); // not ok either $db = mysqli_connect('127.0.0.1', 'root', 'password', 'test'); mysqli_query($db, 'SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;'); $query = mysqli_query($db, 'SELECT * FROM test'); while($test = mysqli_fetch_assoc($query)) { echo $test['name'].\n; } $db = mysql_connect('localhost', 'root', 'password'); mysql_query('SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;', $db); mysql_select_db('test', $db); $query = mysql_query('SELECT * FROM test', $db); while($test = mysql_fetch_array($query, MYSQL_ASSOC)) { echo $test['name'].\n; } ? = Output should be: 你好 我好 你好 我好 Output now was: `} } `} } =resin-web.xml=== web-app xmlns=http://caucho.com/ns/resin; database jndi-namejdbc/discuz/jndi-name driver type=com.mysql.jdbc.Driver urljdbc:mysql://localhost:3306/test? useUnicode=trueamp;characterEncoding=UTF-8/url !-- not ok either urljdbc:mysql://localhost:3306/test/url -- userroot/user passwordpassword/password init-param characterEncoding=UTF-8 / init-param useUnicode=true / /driver max-connections200/max-connections /database servlet-mapping url-pattern=*.php servlet- class=com.caucho.quercus.servlet.QuercusServlet init databasejava:comp/env/jdbc/discuz/database script-encodingUTF-8/script-encoding compilefalse/compile php-ini unicode.runtime_encodingUTF-8/unicode.runtime_encoding unicode.output_encodingUTF-8/unicode.output_encoding /php-ini /init /servlet-mapping welcome-file-list welcome-fileindex.php/welcome-file /welcome-file-list /web-app = mysql db script=== -- MySQL dump 10.13 Distrib 5.1.24-rc, for Win32 (ia32) -- -- Host: localhostDatabase: test -- -- -- Server version 5.1.24-rc-community /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `test` -- DROP TABLE IF EXISTS `test`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE `test` ( `name` varchar(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -- -- Dumping data for table `test` -- LOCK TABLES `test` WRITE; /*!4 ALTER TABLE `test` DISABLE KEYS */; INSERT INTO `test` VALUES (0xe4bda0e5a5bd); INSERT INTO `test` VALUES (0xe68891e5a5bd); /*!4 ALTER TABLE `test` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40014 SET [EMAIL PROTECTED] */; /*!40014 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40101 SET [EMAIL PROTECTED] */; /*!40111 SET [EMAIL PROTECTED] */; -- Dump completed on 2008-05-17 6:35:33 = -Wesley ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ___ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest