mysql中文问题 <%@page contentType="text/html;charset=GB2312"%> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用getBytes()函数,很多书中都有介绍的。希望你尽快解决!:) 用getBytes把所有的字符都转成ISO8859_1应该没问题。 我用的是函数转换,转换函数如下: public String encode(String str) { String s = "null"; try { String temp_p = str; byte[] temp_t = temp_p.getBytes("ISO8859-1"); String temp = new String(temp_t,"GBK");//GBK处我还用过GB2312等其他中文编码 s = temp; } catch(Exception e) { System.out.println (e.toString()); } return s; } 其实,最简单的解决方法是在连接db时指定参数,如下:jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GB2312 <%@ page contentType="text/html; charset=GBK"%><% request.setCharacterEncoding("GBK"); %>jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GB2312我是这样的 baseDao中的查询方法 业务层类图没有看懂,请帮忙看一下 郁闷了我一个星期的问题,下面是我代码和错误提示!!!求求各位帮帮我!!!! struts2 如何在页面迭代的时候不显示html标记 请教:在JSP中有统计记录集记录条数的函数吗? tomcat中如何彻底解决中文问题,通过改tomcat的原代码 各位大侠,帮帮忙!只要成功,我愿出500分! 菜菜的问题 用jsp做了一个类似csdn的论坛,跟贴者有分~~~ 为什么我不能成功连接sql server 数据库? JSP与Html文件放在哪个文件夹下可以执行? 配置jswdk碰到了一个问题,在书上都找不到答案,求救啊!!!
public String encode(String str)
{
String s = "null";
try
{
String temp_p = str;
byte[] temp_t = temp_p.getBytes("ISO8859-1");
String temp = new String(temp_t,"GBK");//GBK处我还用过GB2312等其他中文编码
s = temp;
}
catch(Exception e)
{
System.out.println (e.toString());
}
return s;
}
<% request.setCharacterEncoding("GBK"); %>
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GB2312我是这样的