Questions about the MySQL utf8mb4 string set.
The table structure is as follows:
The following code:
$db = new mysqli('x', 'xxx', 'xxxxx');$db->select_db('xxx');$db->set_charset('utf8mb4');//这里是一个emoji表情$contents = <<
query($sql);print_r($db->error_list);echo "\t\n";exit();
But after warehousing, is a ?
such as:
Solution.
Reply content:
Questions about the MySQL utf8mb4 string set.
The table structure is as follows:
The following code:
$db = new mysqli('x', 'xxx', 'xxxxx');$db->select_db('xxx');$db->set_charset('utf8mb4');//这里是一个emoji表情$contents = <<
query($sql);print_r($db->error_list);echo "\t\n";exit();
But after warehousing, is a ?
such as:
Solution.
That's right.
Under the premise, the difference between utf8mb4 and UTF8 is that UTF8 uses 3-bit bytecode to store data, while UTF8MB4 stores data with 4-bit byte codes.
Emoji expression is a 4-bit bytecode escaped through the previous paragraph, which itself is unreadable characters, so in the database client will display "? ”。
The emoji expression is displayed where the front-end support is emoji.
Determine if the client supports UTF8MB4, preferably when set names is used.