我已经使用'sqljocky'软件包实现了简单的Web服务器来代理MySQL。 我有字符编码问题,西里尔字形显示错误:
ÐавÑдов ÐиÑалий instead of Давыдов Витайлий
编辑:表格整理为utf8_general_ci
。
我试图查询SET NAMES UTF8
:
pool.query('set names utf8');
[更新]然后我使用以下内容在/ etc /目录中创建了my.cnf:
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
show variables like "%char%";
mysql> show variables like "%char%";
+--------------------------+--------------------------------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.6.12-osx10.7-x86_64/share/charsets/ |
+--------------------------+--------------------------------------------------------+
8 rows in set (0,00 sec)
show variables like 'collation%'
mysql> show variables like 'collation%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0,00 sec)
但仍然显示不正确的字符。
如何正确显示?
答案 0 :(得分:1)
sqljocky中存在一个错误,意味着unicode字符未被正确编码。我已经修复了我刚刚发布的v0.5.5中发生错误的一些地方。当我有更多时间时,我会确保它在任何地方都得到修复。