我的mysql 5.1 用的是 utf8字符集, 这 个字符集是不是不支持中文啊 , 怎么不管插什么 中文数据就抱错
我该怎么解决往mysql 中插中文数据 最好配置一次就好 还有我的jsp页面用的也是 utf-8,
我该怎么解决往mysql 中插中文数据 最好配置一次就好 还有我的jsp页面用的也是 utf-8,
解决方案 »
- 为甚麽我的web.xml的welcome-file没有用呢
- mysql 如何给字段设置自动增长?
- jsp文件中有action=""調用自己,這個網頁中的變量還會保存嗎?
- url问题
- 在一个Blog网站看到了“聚合”,旁边有个“XML”按钮,有什么用呢?
- Intellij idea的代码动态提示如何打开?
- 奇怪的问题!
- 高手 请问BBS怎么连数据库啊
- 超难问题 ( 2 ) !!!在线等待中。。。。急!!!
- Help!!!!where to download Inprise Appiction Server? I cannot do from www.inprise.com
- DES加密数据库密码字段
- Servlet和Tomcat的环境配置问题,急!!!
那 如果我是重jsp 得到数据 往mysql 插数据, jsp 的字符集不是GBK 是不是插入的数据是乱码!! 比如 我的jsp 默认的是gb18030 而mysql 用的gbk
不妨在getParameter()
获取请求信息前加入
request.setCharacterEncoding("gb2312");
希望对你有帮助
不妨在getParameter()
获取请求信息前加入
request.setCharacterEncoding("gb2312");
希望对你有帮助
不妨在getParameter()
获取请求信息前加入
request.setCharacterEncoding("gb2312");
希望对你有帮助
在里面找到:default-character-set=将值改成gbk或gb2312或utf8都可以,
如下面:default-character-set=utf8
假设连本地的test数据库:
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8;
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
# 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.2/"#Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 5.2/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=gbk这两处默认的编码方式可能是不支持中文的 ,修改一下
在创建表的时候需要插入中文的字段后面加上character set utf8
比如
id int(4),
address varchar(200) character set utf8,
....
....
第二: 数据库是不是utf-8,注意 数据库也许是utf-8,但要确认表是不是utf-8,也许那个字段不是utf-8
自己玩去巴