在用grails做第一个测试系统的时候遇到了中文乱码问题,本以为是grails的问题,从网上找了找才发现是mysql的问题。。
。
解决方法是:修改mysql安装路径下的my.ini文件
# CLIENT SECTION # ---------------------------------------------------------------------- # # The following options will be read by MySQL client applications. # Note that only client applications shipped by MySQL are guaranteed # to read this section. If you want your own MySQL client program to # honor these values, you need to specify it as an option during the # MySQL client library initialization. # [client] port=3306 [mysql] default-character-set=gbk
# The default character set that will be used when a new schema or table is # created and no character set is defined default-character-set=gbk
然后把已建立的表都删除,让grails重新生成,就OK了。
本文介绍了解决使用Grails开发系统时遇到的中文乱码问题的方法。通过修改MySQL的my.ini文件中的字符集设置为GBK,并重新生成数据库表,可以成功解决中文显示乱码的问题。
179

被折叠的 条评论
为什么被折叠?



