S
S
swcalc2016-02-02 04:47:17
PHP
swcalc, 2016-02-02 04:47:17

How to store emoji emoticons in the database?

12452ae15d364490bfe05f037c43d158.png
Hello, I accidentally stumbled upon an Instagram post on Google, there is a picture in the text, which surprised me, because it looks in its original form in the source code.
The question is, in what form can it be saved in mysql?
Post in Google search results

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2016-02-02
@swcalc

Emoji are 4-byte characters, and since ios5 they are also 3-byte.
You can normally store them in 3 ways:
1) By converting the connection to the database and the tables themselves to utf8mb4 encoding, while there may be problems with default settings on cheap hostings and ready-made engines (keys no longer fit in length, etc.)
2) Store in the database in as base64 or json in a regular field
3) Store as VARBINARY or BLOB

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question