temp=new String(temp.getBytes("ISO8859_1"),"GB2312");
错误语句,temp还没有new出来,哪来的getBytes?
String temp;
temp=new String(oldtemp.getBytes("ISO8859_1"),"GB2312");oldtemp是要处理的String.
错误语句,temp还没有new出来,哪来的getBytes?
String temp;
temp=new String(oldtemp.getBytes("ISO8859_1"),"GB2312");oldtemp是要处理的String.
加这一段怎么样?
http://www.jspserver.com:8080/cgi-bin/jspbbs/topic.cgi?forum=3&topic=3&show=
String tempStr1=new String((request.getParameter("ParaName")).getBytes("ISO8859-1"),"gb2312");
System.out.println(request.getCharacterEncoding());
打出来的,竟然是null。
不知道为什么request的getCharacterEncoding()返回的会是空?
是什么忘了
import
public String chStr(String str)
{ String temp_p=str;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
return temp;
}
%>
试一试这个函数
public String getChinese(String str){
try{
String str1=str;
byte[] str2=str1.getBytes("ISO8859-1");
String temp=str2.toString();
return temp;
}
catch(Exception e)
{
}
return "Null";
}