0

whenever we write é or € in a text and save it to our database (MySQL) it is stored properly. I see a é or € for example in the text.

Whenever I output it e.g. echo $text; on my website it shows an diamond with an question mark in it.

I tried setting my table to UTF-8 and things like that, but nothing solved my problems.

I am hosting on a Ubuntu server with Apache2 and PHP7.2.

Can someone please tell me how I can fix this? I would love to be able to just write special characters in my text and just save it to the database and it then being displayed properly so I dont have to bother typing stuff like € instead of just plain €.

Best regards

Devbizz
  • 81
  • 1
  • 7
  • 1
    Possible duplicate of [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Quentin May 06 '18 at 13:17

1 Answers1

0

You have to set charset utf8 in your mysql connection of the project.

If you are using raw php then use "set_charset" function. You can check this function description from this link

http://php.net/manual/en/mysqli.set-charset.php

Or if you are using any framework then find how to set charset to utf8 on your mysql connection for that framework.

Tanvir
  • 126
  • 6