0

I have a database which contains some blocks of text. These text blocks contain extended characters such as: ’ ‘ … “ and ”. When displayed directly to a web page they all show like this: �.

I've tried doing as str_replace to show normal characters, with no luck. I've tried iconv, which will only work when set to ignore, which makes the punctuation look wrong. I've tried html_encode, which also doesn't work. (I'm also using the parsedown script to format the text.)

The funny thing is, the website I'm replacing supports these characters fine, so I don't know what I'm doing wrong! (I don't have access to this website, or source code, or database, which is why I'm replacing it!)

Can anyone provide any help??

I just want to stop showing � and start showing proper characters!

Philip Lewis
  • 57
  • 2
  • 9

1 Answers1

0

Thanks to the above linked article, this issue is now resolved.

I firstly changed the collation of all of my tables as follows:

Specify the utf8mb4 character set on all tables and text columns in your database.

Then in my php code where it connects to the database, I added this line:

$CONNECTION -> set_charset('utf8mb4'); 

All issues resolved! Thanks to all who contributed to my fix!

Philip Lewis
  • 57
  • 2
  • 9