字符转码一下:public static String getReadStr(String str) {
try {
String temp_p = str;
byte[] temp_t = temp_p.getBytes("ISO8859-1");
String unicode = new String(temp_t,"GBK");
return unicode;
}
catch(Exception e) {
return "null";
}
}
try {
String temp_p = str;
byte[] temp_t = temp_p.getBytes("ISO8859-1");
String unicode = new String(temp_t,"GBK");
return unicode;
}
catch(Exception e) {
return "null";
}
}
<%@page language="java" contentType="text/html; charset=GB2312"%>
throws Exception
{
if(s == null)
return "";
byte[] b = s.getBytes("gb2312");
s = new String(b, "ISO8859_1");
return s;
}
TechnoFantasy的方法是可以用的
你在对照一下
改成res.setContentType("text/html;charset=gb2312");
用了
在res.setContentType("text/html");
改成res.setContentType("text/html;charset=gb2312");
就可以了
我在试试TechnoFantasy的方法看看。:)