现在因为下面的现象我觉得我完全不懂字符集。起初我认为只有utf8mb4支持表情符号字符,例如。 见下文:
As of MySQL 5.5.3, the utf8mb4 character set uses a maximum of four bytes per character supports supplemental characters
但不小心我发现了这种现象,见下文:
mysql> show variables like 'character%';
+--------------------------+---------------------------------------+
| Variable_name | Value |
+--------------------------+---------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /opt/mysql/server-5.6/share/charsets/ |
+--------------------------+---------------------------------------+
mysql> show create table t4\G
*************************** 1. row ***************************
Table: t4
Create Table: CREATE TABLE `t4` (
`data` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
mysql> insert into t4 select '\U+1F600';
mysql> select * from t4;
+------+
| data |
+------+
| |
+------+
现在我非常困惑,似乎latin1也可以支持表情符号。我知道它一定是幻觉,但我不知道如何清除它?
答案 0 :(得分:0)
您无法将其他iso-8859-1 characters存储到latin1字段中而不将其转换为例如BASE64
它可能会起作用,但稍后会在某些时候失败。特别是像表情符号这样的多字节字符。