0

On my PHP, it takes item descriptions from the MySQL database but shows apostrophes as replacement characters (the diamond with a question mark inside. The database collation I used is utf8mb4 since I thought that the database being on default was causing the problem, but it's not.

I tried to use utf8_encode and decode, but it only shows them on other characters, a box on utf8_encode, and a question mark on uts8_decode. Any idea how to fix this problem?

inn0ichi
  • 13
  • 3
  • Could it be that it is not PHP, but your browser showing you those characters? – Gerard H. Pille Jan 26 '21 at 23:27
  • im using google chrome. i tried adding fonts to it but it still shows the replacement characters – inn0ichi Jan 26 '21 at 23:50
  • Try adding this to the head section of your html page: ` ` to tell the browser what kind of characters it is displaying. – Alan Jan 26 '21 at 23:59
  • 1
    Please refer to the guidance here: [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – ADyson Jan 27 '21 at 00:51

1 Answers1

0

Thanks to user @ADyson. UTF-8 all the way through

I added set_charset("utf8mb4") on my config so it would load that charset by default.

$this->connection->set_charset("utf8mb4");
inn0ichi
  • 13
  • 3