Recently, i had the need to store emoji in some of the table in my DB (MySQL / MariaDB), so after a bit of research i've found out that the encoding i was using (UTF8) wasn't enough and i needed to move to UTF8-mb4.
I then changed the charset of the table i needed to the new encoding, but clearly it wasn't enough. I changed also my connection string i use when creating a new DbConnection, specifying the encoding utf8mb4, and still i couldn't manage to save emojy.
Finally i've found this answer Using utf8mb4 in MySQL , which suggested the use of SET NAMES
instruction.
This solved my problem, but i noticed that the instruction was active until i restarted the db service.
I would like to know:
- which exactly is the effect of using
SET NAMES
instruction, especially for the tables that are using the old utf8 encoding? - which is the proper way to use it? (In my.ini or in my code?)
- Is there anything i need to worry about this instruction?
- Are there other ways to set character_set_client and character_set_connection to utf8mb4?