5

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 ?

EkinOf
  • 451
  • 1
  • 7
  • 18
  • Check your files' encoding. You're probably mixing them wrong. – Charles Sep 21 '15 at 16:50
  • @charlesrockbass The question clearly states that writing directly in the view works, and that the data comes from the database. File encoding won't matter. – Joel Hinz Sep 21 '15 at 16:57

1 Answers1

5

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.

EkinOf
  • 451
  • 1
  • 7
  • 18