注册 登录
编程论坛 J2EE论坛

字符编码时为什么转换中文不好使啊!

IT爱好者 发布于 2007-08-15 21:36, 521 次点击

String Chinese=new String((name.getBytes("iso-8859-1")),"gb2312");
System.out.println(Chinese);

----------------------------------
这种方法也不好使
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
request.setCharacterEncoding("gb2312");
chain.doFilter(request, response);
} catch (Exception e) {
e.printStackTrace();
}

}
请各位帮帮忙
2 回复
#2
ermaogogo2007-08-15 21:39

有过滤器给你用都是好的了..还嫌啊.你想写00110101101010101.

#3
guoxhvip2007-08-15 22:24
没办法 只有注意编码
1