newLISP访问MySQL中文乱码

使用newLISP 的标准mysql模块或者Artful Code模块都得到的中文乱码。

解决方法如下:

首先确保mysql内部设置的是UTF-8,

但是用newlisp查看的时候,仍然一部分时latin.

用下面的命令可以解决:

> (MySQL:query "SET character_set_client = utf8;")
true

(MySQL:query "SET character_set_connection = utf8;")
true
> (MySQL:query "SET character_set_results = utf8;")

现在再验证一下:

> (MySQL:query "SHOW VARIABLES LIKE ‘character%‘;")
true
> (dotimes (x (MySQL:num-rows)) (println (MySQL:fetch-row)))
("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/share/mysql/charsets/")
("character_sets_dir" "/usr/share/mysql/charsets/")

现在搞定了。


newLISP访问MySQL中文乱码

上一篇:mysql-python socket连接错误


下一篇:通过dbms_xplan.display_cursor识别低效的执行计划