Today I will put down the way to begin a new web application project using CakePHP.
The first part is database creation. Database charset must be utf-8 and collation: utf8_unicode_ci. The difference between general and unicode collations is explained in an excellent manner in this post on stackoverlow.com
Next, when you start a new CakePHP project the database config class looks like this
public $default = array( 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'user', 'password' => 'password', 'database' => 'test_database_name', 'prefix' => '', // 'encoding' => 'utf8', );
My lesson today is: Before changing anything else, uncomment the last line!.
... in case you do not then Unicode (Greek in my case) text will still appear correctly in the web application, but phpMyAdmin and sqldump will display garbage. In addition searches with non-latin text will always fail. To make matters worse when I discovered the case of the problem, I realised that I would have to re-enter all my test data.