public String getStr(String str)
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e)
{
return "null";
}
}传值输出的用这个函数转换一下再输出看
{
try
{
String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}
catch(Exception e)
{
return "null";
}
}传值输出的用这个函数转换一下再输出看
1.入库前改变其的编码,出库时候也也变其编码,
2.在联接时加(库名?useUnicode=true&characterEncoding=(编码如utf-8))
在JSP页面用GBK等的编即可!
就写这么多,jdbc:mysql://localhost:3306/test。
多试试,乱码是讨厌,祝福一下。
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=gb2312
这样就可以了。
2. jdbc:mysql://localhost:3306/test(什么都不加)
3. JDK从5.5降下来的 还是不行。
4. 我用的SQL语句太多,编码太多了!
以上都不行啊 !!!我真的疯了!!!!
跪求解法!
如:
String name = rs.getString("name");
name = new String(name.getBytes("ISO-8859-1"), "GBK");
out.println(name);这样就可以了.