Problems displaying French accented characters in UTF-8

前端 未结 4 1826
清酒与你
清酒与你 2021-01-12 07:14

I\'m working on a French language site built in CakePHP. I have tried multiple functions to try and convert the text into UTF-8 and display properly, but have had no succes

4条回答
  •  隐瞒了意图╮
    2021-01-12 07:31

    I just fixed a very similar problem with accented characters not displaying. My database table is utf-8 encoded and my html header is correctly set for utf-8.

    I hadn't specified a charset for my MySQL connection, in my case I'm using PDO.

    $this->pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8;", $username, $password);
    

    No problems now!

提交回复
热议问题