mysql_query ("SET NAMES utf8") solved my problem.
Problem: characters are displayed correctly in phpMyAdmin, incorrectly in HTML / PHP. Characters: â, î etc.
The headers are in order (utf8), phpmyadmin displays the content in the correct form, but the website continues to show strange question marks (inside the black diamond symbol).
HTML code:
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Solution: I added in php (before any other requests):
mysql_query("SET NAMES utf8");
Other causes may lead to this behavior; this is only one part of the solution. You may need to check the content type, web server configuration (httpd.conf), html lang / dir, charset, etc. However, the question mark in black diamond seems to be more specific to this problem / solution, in other cases 2-3 strange characters are displayed, not the one you want.
source share