MYSQL在终端下中文显示正常,但在JSP调用显出乱码!
MYSQL在终端下中文显示正常,但在JSP调用显出乱码!我在/etc/mysql/my.cnf中加了default-character-set=utf8
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
default-character-set=utf8
skip-external-locking
用JSP查询显示乱码,用(new String(string.getBytes("ISO-8859-1"),"gb2312")还是显乱码
用<%@ page contentType="text/html; charset=GB2312;pageEncoding="gb2312"%>还是显乱码
上面的编码中用UTF-8,GBK,GB2312,LATIN1,ISO-8859-1等编码试过了,结果还是乱码,不知道是何原因??? 建议先用PMA搞一搞。 经典问题,关注。
不过应该是,不知道是不是问题的真正原因
new String(string.getBytes("ISO8859-1"),"gb2312"
页:
[1]