Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which SQL collation to use for special characters such as é? [duplicate]

How do I make special characters appear in my PHP page, knowing that I call the content using an SQL query. For example é appears as � and so on for all other special characters.

I'm using a MySQL server. The db collation was set to utf8_unicode_ci, however some attributs of the tables were set to latin1_swedish_ci

like image 979
Amine Avatar asked Oct 28 '25 09:10

Amine


2 Answers

ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;

This should work for entire DB. Source

like image 103
Penguin74 Avatar answered Oct 31 '25 02:10

Penguin74


Use the UTF-8 character set when you create a database or table:

CREATE DATABASE Soccer CHARACTER SET utf8 COLLATE utf8_general_ci;

You can find further information here.

like image 25
imant Avatar answered Oct 31 '25 02:10

imant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!