P
P
po472021-10-07 12:12:53
Yii
po47, 2021-10-07 12:12:53

How to get rid of the conversion to a smiley text for writing to the database?

The entry in the database contains a column with a line like - "Тест; Тест тест тест: &#128222 &#11088 ", those contain emoticons. After certain manipulations related to the translation of the text language, json_decode(of this line) is executed and the line becomes "Test; Test test test: ⭐ ". In this form, the record does not occur in the database. Encoding of both strings is UTF-8, checked with

mb_detect_encoding()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2021-10-07
@ThunderCat

Encoding for both strings is UTF-8
set utf8mb4 for tables and for connecting to the database, the encoding is backward compatible with utf8, nothing will fly away during conversion, and all utf8 tables will also be read normally. It makes sense to change the encoding only in those tables that will directly store emoticons, in other tables it is not justified.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question