0

My website alancrookes.com display the results of a MySQL query in a HTML table. Some of the characters which are stored correctly in the database are displaying with as a black diamond with a question mark.

I have added the code <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> to the HTML file but it doesn't help.

Would anyone know how to solve this. I have tried this post but to no avail.

TIA.

Alan
  • 311
  • 6
  • 14
  • The mentioned duplicate is about UTF-8, but the basic aspects mentioned in there are applicable for other character encodings as well. (Plus, you should perhaps consider _switching_ to UTF-8, because that is really more or less the standard these days.) – CBroe Jun 18 '21 at 13:20
  • Your response header of [http://alancrookes.com/](http://alancrookes.com/) (that's really a website link, while you only posted a [domain](https://en.wikipedia.org/wiki/Domain_name)) is `Content-Type: text/html; charset=UTF-8` which overrules what you define in your HTML. – AmigoJack Jun 19 '21 at 08:42
  • Thanks for the comments, the link provided by @CBroe pointed me in the right direction. I hadn't seen it before so thanks. The code I added was `if (!$db->set_charset("utf8mb4")) { //printf("Error loading character set utf8mb4: %s\n", $db->error); exit(); } else { //printf("Current character set: %s\n", $db->character_set_name()); }` – Alan Jun 24 '21 at 11:16
  • See "black diamond" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Oct 28 '21 at 22:54

0 Answers0