What is the desired encoding for the database?

In General, the task in the database to store the text with all sorts of emoticons. Googled it, set the encoding from utf8 to utf8mb4. Everything is OK But there is a problem, there was a smile: who does not want to be written to the database. This is normal: ✅ and this is not: *тут_должен_был_быть_смайл_но_он_вырезается_после_публикации* error incorrect value. In a text editor it is also not displayed and is written as \uD83D \uDCCC .
What encoding it is necessary to use?

PS: Oh, after posting the question here he also does not appear.
March 19th 20 at 08:41
3 answers
March 19th 20 at 08:43
Solution
What kind of encoding you have changed the database, table or column?
\uD83D \uDCCC is a pair of High surrogate Low surrogate
1000016 + 40016 * (D83D16 - D80016) + (DCCC16 - DC0016) = 1F4CC16
The Symbol "Pushpin",
Initially, only tables, then for the answer to everything: database, table and column - the error remains:

ALTER DATABASE dbname CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE table1 CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE table1 MODIFY description TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - hailee.Colli commented on March 19th 20 at 08:46
@hailee.ColliThat shows SHOW CREATE TABLE `table1` - rosamond88 commented on March 19th 20 at 08:49
@rosamond88, like all true shows:
CREATE TABLE `table1` (
 `id` int(11) NOT NULL,
 `type` int(2) NOT NULL,
 `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 `title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `description` text COLLATE utf8mb4_unicode_ci
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

And when you INSERT\UPDATE osuka: "[22001][1366] Data truncation: Incorrect string value: '\xF0\x9F\x93\x8C' for column 'description' at row 1". A string of only that character. - hailee.Colli commented on March 19th 20 at 08:52
@hailee.Colli, And the connection in which encoding is?
show variables like 'char%' - rosamond88 commented on March 19th 20 at 08:55
@rosamond88, Yes, the connection uses utf8. But utf8mb4 not change, not connect to the server.

character_set_client utf8
character_set_connection utf8
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/ - hailee.Colli commented on March 19th 20 at 08:58
@hailee.Colli, Try or after connection SET NAMES utf8mb4or in the config servers
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
- rosamond88 commented on March 19th 20 at 09:01
@rosamond88, SET NAMES utf8mb4 not helped, and configure the server helped! Thank you for your help! - hailee.Colli commented on March 19th 20 at 09:04
March 19th 20 at 08:45
UTF-16LE
Although eight it is.
March 19th 20 at 08:47
Googled it, set the encoding from utf8 to utf8mb4.

Inspection is done? Should look like this:
MariaDB [(none)]> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+------------------------+
| Variable_name | Value |
+--------------------------+------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| collation_connection | utf8mb4_unicode_520_ci |
| collation_database | utf8mb4_unicode_520_ci |
| collation_server | utf8mb4_unicode_520_ci |
+--------------------------+------------------------+
10 rows in set (0.01 sec)

Find more questions by tags UnicodeMySQL