Re: The MySQL UTF8 Issue
https://trac.cakephp.org/browser/branches/1.2.x.x The future is now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
sounds good. looking forward to Cake 1.2. 2006/9/4, nate <[EMAIL PROTECTED]>: > > Cake 1.2 now supports this natively. Just add 'encoding' => 'UTF-8' to > your database configuration and the querying is taken care of > automatically at the database level. > > > > > -- e> [EMAIL PROTECTED] w> http://andreas-waidelich.de m> +49.177.423 09 48 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Cake 1.2 now supports this natively. Just add 'encoding' => 'UTF-8' to your database configuration and the querying is taken care of automatically at the database level. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
to reduce the number of SET NAMES queries add a static boolean variable to your AppModel an set it to false. Check the value of the variable in your constructor and execute SET NAMES only, if it has not been done before. E.g. class AppModel extends Model{ static $utf8IsSet = false; function __construct(){ if(!self::$utf8IsSet) { $this->execute("SET NAMES 'utf8'"); self::$utf8IsSet = true; } parent::__construct(); } } -- e> [EMAIL PROTECTED] w> http://andreas-waidelich.de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Thanks for the tip. I've finally gotten my Korean website working with it as well. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
You have it in the wrong order. Do this: class AppModel extends Model { function __construct() { parent::__construct(); $this->execute("SET NAMES 'UTF8'); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Andreas But I found it can't work. The error Fatal error: Call to a member function fetchAll() on a non-object in D:\php-5.0.4-Win32\PHP_Script\PHP_CAKE\cake\libs\model\model_php5.php on line 1143 will occur though I add you appmodel in my app_model.php in the cake directory. I think It can't execute any sql statment in model constructor. Because the database connection hasn't be created. So the error occur. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Thanks Andreas , I add the code in the model int the model directory, so it can't work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
If you overwrite the model constructor, then you have to call parent's one Have you done parent::__construct () ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Can you paste your code, please. 2006/4/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Andreas: > When I add the __construct() function into my model. I got this error: > > Fatal error: Call to a member function fetchAll() on a non-object in > D:\php-5.0.4-Win32\PHP_Script\PHP_CAKE\cake\libs\model\model_php5.php > on line 1143 > > I don't know why. > > > > > -- e> [EMAIL PROTECTED] w> http://andreas-waidelich.de m> +49.177.423 09 48 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Andreas: When I add the __construct() function into my model. I got this error: Fatal error: Call to a member function fetchAll() on a non-object in D:\php-5.0.4-Win32\PHP_Script\PHP_CAKE\cake\libs\model\model_php5.php on line 1143 I don't know why. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
You just have to do it once in your AppModel (located in your application's root directory). my AppModel looks like this: class AppModel extends Model { function __construct() { $this->execute("SET NAMES 'UTF8'); parent::__construct(); } } 2006/4/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Andreas: > Is any Model should add $this->execute("SET NAMES 'utf8'"); ? >Or only one model is enough? > > > > > -- e> [EMAIL PROTECTED] w> http://andreas-waidelich.de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Andreas: Is any Model should add $this->execute("SET NAMES 'utf8'"); ? Or only one model is enough? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
I used my AppModel to solve the issue. function __construct() { $this->execute("SET NAMES 'utf8'"); parent::__construct(); } 2006/4/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Thanks for everyone. I have made the ticket for this problem. > > > > > -- e> [EMAIL PROTECTED] w> http://andreas-waidelich.de --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
Thanks for everyone. I have made the ticket for this problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
I think this is a good idea. Why not make a ticket for it in trac? (https://trac.cakephp.org/) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
I had the same problem (with Cyrillic letters), and only/most elegant solution I found was to modify the core. Try this: in file "cake/libs/model/dbo/dbo_mysql.php" find function connect(). Replace these lines: if (mysql_select_db($config['database'], $this->connection)) { $this->connected = true; } with this: if (mysql_select_db($config['database'], $this->connection)) { mysql_query("SET names utf8"); $this->connected = true; } I wish there was more elegant solution, without modifying the core. Perhaps another setting in DATABASE_CONFIG (app/config/database.php), something like: var $default = array('driver'=> 'mysql', 'connect' => 'mysql_connect', 'host' => 'localhost', 'login'=> 'user', 'password' => 'password', 'database' => 'project_name', 'charset' => 'utf8', 'prefix'=> ''); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: The MySQL UTF8 Issue
check this: http://rossoft.wordpress.com/2006/02/11/mysql-and-utf-8/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
The MySQL UTF8 Issue
I use mysql5 and utf8 table to store Chinese data. Everything insert into the utf8 tables though cake can be fetch out by cake fine. But when I use other database tools (such as MySQL Query Browser) to query the data which insert by cake will got unreadable characters. I'm so confuse on it, and serach on the internet. I think there is something wrong with the mysql connections setting in cake. In my controller I query the MySQL connection setting by do this ... $msg = $this->MyModel->findBySql("Show VARIABLES LIKE '%CHARACTER_SET%';"); // Then set the result varable $msg to display in views $this->set('msg',$msg); In view: ... debug($msg); ... Then I got this result: Array ( [0] => Array ( [VARIABLES] => Array ( [Variable_name] => character_set_client [Value] => latin1 ) ) [1] => Array ( [VARIABLES] => Array ( [Variable_name] => character_set_connection [Value] => latin1 ) ) [2] => Array ( [VARIABLES] => Array ( [Variable_name] => character_set_database [Value] => utf8 ) ) [3] => Array ( [VARIABLES] => Array ( [Variable_name] => character_set_results [Value] => latin1 ) ) [4] => Array ( [VARIABLES] => Array ( [Variable_name] => character_set_server [Value] => utf8 ) ) [5] => Array ( [VARIABLES] => Array ( [Variable_name] => character_set_system [Value] => utf8 ) ) [6] => Array ( [VARIABLES] => Array ( [Variable_name] => character_sets_dir [Value] => D:\Program Files\MySQL\MySQL Server 5.0\share\charsets\ ) ) ) The character_set_client,character_set_results,character_set_connection is Laten1, and the other is utf8. I think the problem is here. So I continue the test: When I query the data in the utf8 table by convert the field to laten1 encoding, I can get the right chinese string. The SQL is: SELECT CONVERT(myField USING utf8) from myUtf8Table; How can I change the database connection setting to solve this problem? Should I modify the core code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---