Reputation: 451
I use Laravel 5.1 and a mysql server. I have a database with table in utf8 unicode, and my databse configuration file is like this :
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'false',
),
But when I use queries from eloquent, my texts which have accents are broken. It's not a problem from blade because I can write accent in the views correctly, and if I use PDO directly my text is nice.
How can I solve my problem with my queries from eloquent ?
Upvotes: 5
Views: 16507
Reputation: 451
I found my problem, I hope it will help others :
My Mysql databases are encoded in latin1 by default. I was sure that my databases were in utf8 so I configured as that in the configuration file on my laravel project.
Upvotes: 5