你先把数据从db中取出来,然后再进行转换。
这样试试
public String getStr(String str){
try{
Strin temp_p =str;
byte[] temp_t = temp_p.getBytes("GBK");
String temp = new String(temp_t,"ISO8859_1");
}catch(Exception e){
}
return "null";
}
这样试试
public String getStr(String str){
try{
Strin temp_p =str;
byte[] temp_t = temp_p.getBytes("GBK");
String temp = new String(temp_t,"ISO8859_1");
}catch(Exception e){
}
return "null";
}
2、用找个函数转换一下后,所有中文都成 ?了。
3、"你先把数据从db中取出来,然后再进行转换",如果从db中取出来,结果集的getString方法?
这个是UN码与gb2312的转换问题,你指定一下就行了,
不过catblue(limiaomia的方法是可行的,只是数据多时不好办。
在最上面加上:
<%@ page contentType='text/heml; charset=gb2312'%>
2,参数是中文乱码,解决方法:
代码前面加一行:
request.setCharacterEncoding('gb2312')
3,另处解决方法:
用weblogic 8.1,or tomcat5.0以上没事。
因为他们内置了解决方法。
1、你说的jsp页面上加这个东东都加了,并且还不能是gb2312!如果是gb2312的话,直接out.println("李旻");在页面上就出现乱码:李?
2、应该和1一样。
3、没试过。“这个是UN码与gb2312的转换问题,你指定一下就行了,”如何指定?
new String(strRtn.getBytes["GB2312"],"GBK"));吗?还是李?啊??????