Cakephp Does Not Display Special Characters Present in Database Content

Asked

Viewed 220 times

1

I get something like:

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

But the wait was to get :

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

This only happens with database data, which is correctly within the table with these characters. The database is configured as utf8_unicode_ci, as well as the tables and their fields, and the UTF-8 Unicode server, as well as Cakephp. How to solve this?

  • Is tagged meta setting the charset in HTML (<meta charset="utf-8">)?

  • Yes have this tag inserted.

  • 3

    The connection encoding is set in the cake.php database?

  • No, and after removing the comment already works. Please reply to give the right answer sff. Thank you.

  • I did this. A tip: when addressing a user who has already commented, include @username_da_pessoa in the comment, and he will be notified.

  • Okay I’m sorry, I always forget that.

  • No problem! Is that if you stop doing this, the person may never see your comment (I almost missed this for me).

Show 2 more comments

1 answer

2


In the bank configuration that is in app/Config/database.php, you need to define the encoding connection. In the case of the Cake for Mysql example configuration, 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
    );
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.