Recently I switched the web hosting service provider, and noticed these odd black diamond shaped characters with a question mark in the middle
on my web pages. Characters such as the double quote and the copyright symbol are all being replaced by this foul black diamond character with the ? in the center. Doing some research, it seems that happens because you have a character set, or charset
, that does not match between the database, web server, and PHP.
I use Apache, MySQL, and PHP. Looking at the httpd.conf I noticed:
In PHP.ini I see:
default_charset = "iso-8859-1"
and in my MySQL tables I see "DEFAULT CHARSET=latin1" when I do a "Show Create Table my_table_name".
Not wanting to convert my MySQL data to UTF-8, I edited the line in httpd.conf that showed "AddDefaultCharset UTF-8" to:
I also edited the header file for my PHP web pages to show:
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
Voila- no more weird black diamond character with the question mark inside.