0

I've made a PHP project which I've deployed to Heroku. Everything works except for special characters. I need to be able to use characters like "á,é,ý" etc. All of those characters do not render properly and instead get replaced with the following symbol "�". I've tried looking for a solution online but didn't find any mention of this anywhere. In my local environment all the characters are displayed properly.

All the text is fetched from the database using a MySQLi query. The database is hosted by the ClearDB addon which Heroku offers and which I added to the project. To keep the database in sync I've exported the database locally in phpMyAdmin as a SQL file and then imported the file into the ClearDB remote database through phpMyAdmin. During the import I made sure to choose utf-8 as the character set for the import. In phpMyAdmin the text gets gets displayed properly in all of the tables. Upon loading the webpage not a single error or warning shows up in the browser console regarding any failure of fetching the font used. All the other non-special characters also are displayed properly with the proper custom font used.

The webfont that I'm using does support all of the required special characters and they work on my local environment like I mentioned.

How do I make sure that the text gets displayed properly on Heroku?

541daw35d
  • 141
  • 2
  • 12
  • Make sure you set the right connection charset, i.e. `utf8mb4`. I think this is the most likely reason if you are using mysqli as most people have no idea how to use mysqli properly. See https://phpdelusions.net/mysqli/mysqli_connect – Dharman Nov 19 '21 at 13:22
  • See "black diamond" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored – Rick James Nov 20 '21 at 21:02

0 Answers0