我将数据库转换为utf8mb4,但仍然返回错误的UTF8字符:
例如,Café
变为Café
以下是我的mysql排序规则变量:
mysql> SHOW VARIABLES LIKE 'char%'; SHOW VARIABLES LIKE 'collation%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_unicode_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8mb4_unicode_ci |
+----------------------+--------------------+
此外,自从切换到utf8以来,我的数据库已经放慢了至少10倍。
答案 0 :(得分:1)
变为乱码。这是
的经典案例SET NAMES latin1
(或set_charset('latin1')
或...)相关联。 (应该是utf8mb4
。)CHARACTER SET utf8mb4
,也可能不是ALTER TABLE Tbl MODIFY COLUMN col VARBINARY(...) ...;
ALTER TABLE Tbl MODIFY COLUMN col VARCHAR(...) ... CHARACTER SET utf8mb4 ...;
,但应该是这样。如果您需要修复数据,则需要一个" 2步ALTER",类似
NOT NULL
长度足够大而另一个长度足够..." ..."还有其他任何东西(.front-page-img {
background-size: 100%;
width: 100%;
height:0;
padding-bottom:40%;
margin: 0;
opacity: 0.4;
/* background-position: 0px -200px; */
background-repeat: no-repeat;
}
等)已经在列上。