PHP问题与字符集和整理

I working on a website project using Bootstrap 3. The character set I am using on my html pages is utf8. On localhost, I am using MySQL56 where the database for the project has utf8 as character set and utf8_general_ci as collate.

On the remote server, the database I created has the same character set and collate.

When I am doing test on local, the characters appear well but when I am doing the test on remote server, I get diamonds on some characters like 'é' or 'è'. Also, when I write data into the database table, those characters doesn't appear well in PHPMyAdmin, but everything is fine on my computer.

I don't understand where the problem comes from and how to fix it.

Thank you.

Make sure you're setting PHP headers correctly;

header('Content-Type: text/html; charset=utf-8');

You can either place this in a common include in PHP or edit your PHP.ini file and modify/add this line;

default_charset = "utf-8";