[PHP] Special characters being replaced with black diamonds with question mark �

If you ever come across this issue where special characters like aprostrophe's and ñ's are being replaced by this weird symbol, �, it could be a char-set thing.


I tried a couple of solutions but none of them worked, until I looked into my php.ini for anything related to setting the character encoding, and I found that default_charset is set to UTF-8.

I simply changed it to ISO-8859-1, restarted the IIS server, and refreshed the page.


And it worked!

Php.ini can be found on your PHP installation folder, in my case: 
C:\Program Files (x86)\PHP\php-7.4.8\php.ini

Set default_charset to ISO-8859-1 and enable it by removing the ; in front
default_charset = "iso-8859-1"
Share: