用最新版的mysql,没有中文问题。
解决方案 »
- 求个算法
- 自学flex部署问题
- 我用了动态创建表为什么,不能插入数据呢?提示could not get next sequence value
- 基于位运算的权限设计问题。?
- 在修改数据库数据时,发生以下错误,实在 不知道怎么办了“Write operations are not allowed in read-only mode ”
- 关于dom4j解析xml的问题 紧急求救...(在线等待)
- jdbc连接池的javabean
- 非Web工程中如何使用spring?(配置文件applicationcontext.xml能指定位置吗)
- struts问题:导数据!详细情况请进!
- 用axis开发Web Services客户端遇到的问题,急
- spring事务问题
- 求助:Struts中的javascript问题!
如果不是用连接池,试试在连接MySql的时候这样连:jdbc:mysql://localhost:3306/test?autoReconnect=true;useUnicode=true;characterEncoding=GB2312
<form >
<input type="text" name="aa">
</form>
java程序:
String aa = request.new String(getParameter("aa").getBytes("iso8859-1"));
把这样得到的数值插入到数据库就可以了
public static String cvtISO2GBK(String str){
try {
byte[] byteStr = str.getBytes("ISO-8859-1");
return new String(byteStr, "GBK");
}
catch(Exception e) {
return str;
}
}
public static String cvtGBK2ISO(String str){
try {
byte[] byteStr = str.getBytes("GBK");
return new String(byteStr, "ISO-8859-1");
}
catch(Exception e) {
return str;
}
}
}catch(Exception e)
{
e.printStackTrace();
}
name=fileItem.getFieldName();
value=fileItem.getName();
这样在本地页面显示正常,但是插到数据库就成了乱码!
Server=D:/mysql/bin/mysqld-nt.exe
[mysqld]
basedir=D:/mysql
datadir=D:/mysql-data/data default-character-set=gbk //这里
[client]
default-character-set=gbk //这里