This question has already been answered:
I make a small project that uses messages from the database. The scripts themselves (in php) and the output pages from the database in utf-8 encoding. The database is also created in utf-8 encoding.
If I write in the code when adding and when displaying the following:
mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER SET 'utf8'"); mysql_query("SET SESSION collation_connection = 'utf8_general_ci'"); then everything is recorded and displayed correctly in the database (the Cyrillic alphabet is displayed correctly), except ... some emoticons (which are critical for the "customer", as it turned out). Tell me how to be?
mysql_*, they are outdated and in php7 they are no longer there. 2. en.stackoverflow.com/a/220492/186083 (only useutf8mb4instead ofutf8) 3.utf8mb4base into 4 byte UTF-8 ru.stackoverflow.com/a/446474/186083 - Visman