CakePHP does not show special characters present in the contents of the database

1

I get something like:

Produ��es - Casamento Catarina & Lu�s _ Caves Taylor�s

But what was expected was to get:

Produções - Casamento Catarina & Luís _ Caves Taylor's

This only happens with data coming from the database, which is correctly inside the table with these characters. The database is set to utf8_unicode_ci , as are the tables and their fields, and the UTF-8 Unicode server, as well as CakePHP. How do I resolve this?

    
asked by anonymous 15.04.2014 / 18:45

1 answer

2

In the configuration of the database that is in app/Config/database.php , you need to define the encoding of the connection. In case of the example configuration of Cake for MySQL, just uncomment the commented line:

class DATABASE_CONFIG {

    public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'user',
        'password' => 'password',
        'database' => 'database_name',
        'prefix' => '',
        //'encoding' => 'utf8',
        // Descomente a linha acima
    );
}
    
16.04.2014 / 19:31