Window--Preferences--输入jsp,搜索--点击jsp--在相应的字符集设置上设置成自己想要的编码集。
如果这样还是不行的话,说明你数据库字符集设置有问题,这样设置:
首先把MySQL的服务停掉 在运行窗口输入:net stop mysql
把服务器和客户端的字符集改成自己想用的字符集:GB2312
具体 *** 作为:打开mysql安装目录下的myini.tet
找到default-character-set,将其改为自己想用的字符集:GB2312或是utf8等……,要注意的是这里有两个default-character-set,用ctrl+f定位在文件最前面输入defaul就会找到,都要改过来
重启MySQL服务器,在运行窗口输入:net start mysql
最重要的是一点是,到这里我们已经能够解决乱码问题了,可问题是我们依然还会出现乱码问题,这是因为我们现在的表被创建的时候用的是默认的字符集(latin1),所以这时候我们要把表删除,然后重建就可以了
你说的该数据库配置文件吧?windows
下
是在mysql安装目录下的my.ini
linux下/etc/my.cnf
[mysqld]
下面增加
default-character-set
=
utf8
你要改成
default-character-set
=
gb2312
都行
重启mysql
有两种方法...你试一下...不行的话加我的QQ76558882
1.
修改
mysql
安装目录下的
my.ini
修改
default-character-set=latin1
把latin1
改为
gb2312
或
gbk
注意:
修改两处
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=latin1
//把
latin1
改为
gb2312或
gbk
#
SERVER
SECTION
#
----------------------------------------------------------------------
#
#
The
following
options
will
be
read
by
the
MySQL
Server.
Make
sure
that
#
you
have
installed
the
server
correctly
(see
above)
so
it
reads
this
#
file.
#
[mysqld]
#
The
TCP/IP
Port
the
MySQL
Server
will
listen
on
port=3306
#Path
to
installation
directory.
All
paths
are
usually
resolved
relative
to
this.
basedir="C:/Program
Files/MySQL/MySQL
Server
5.0/"
#Path
to
the
database
root
datadir="C:/Program
Files/MySQL/MySQL
Server
5.0/Data/"
#
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=latin1
//将latin1
改为
gb2312
或
gbk
2.
进入在命令提示符下登录mysql
输入
charset
gb2312
你再尝试使用
insert
into
插入一条记看看...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)