V
V
vaflya2019-07-12 10:49:56
PHP
vaflya, 2019-07-12 10:49:56

Emoji work with unicode in html, php and mysql?

Good afternoon, tell me how to work with unicode emoji?
The problem lies with the icons of flags and others.
For normal processing of emoji in MySQL:
устанавливаем кодировку utf8mb4
In html I write them as:
&#x ffff; (без пробелов)
in PHP, as I understand it, there should be no problems?
the essence of the question:
How to specify Emoji (country flags), which are set by 2 values?
U+1F1E6 U+1F1FC

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rsa97, 2019-07-12
@Rsa97

https://unicode-table.com/ru/1F1E6/
https://unicode-table.com/ru/1F1FC/
Accordingly, we get in UTF-8 F0 9F 87 A6 F0 9F 87 BC
Either a string "\xF0\x9F\x87\xA6\xF0\x9F\x87\xBC"
Or HTML codes 🇦🇼

W
wagoodoogoo, 2019-07-12
@wagoodooogoo

Just one after the other
&#x 1F1E6;&#x 1F1F7;

A
Alexander Smirnov, 2019-07-12
@sasha-hohloma

It is better for PHP to convert the string to unicode before writing to the database, and to convert it back when requesting from the database. I used this library on a project and it worked great.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question