public static String UnicodeToChinese(String str){
try{
if (str==null || str.equals("")) {
return "";
}
else{
String newStr=null;
newStr=new String(str.getBytes("ISO8859_1"),"gb2312");
return newStr;
}
}
catch(UnsupportedEncodingException e){
e.printStackTrace();
return str;
}
}
public static String ChineseToUnicode(String str){
try{
if(str==null || str.equals("")) return "";
String newStr=null;
newStr=new String(str.getBytes("gb2312"),"ISO8859_1");
return newStr;
}
catch(UnsupportedEncodingException e){
return str;
}
}
try{
if (str==null || str.equals("")) {
return "";
}
else{
String newStr=null;
newStr=new String(str.getBytes("ISO8859_1"),"gb2312");
return newStr;
}
}
catch(UnsupportedEncodingException e){
e.printStackTrace();
return str;
}
}
public static String ChineseToUnicode(String str){
try{
if(str==null || str.equals("")) return "";
String newStr=null;
newStr=new String(str.getBytes("gb2312"),"ISO8859_1");
return newStr;
}
catch(UnsupportedEncodingException e){
return str;
}
}
<%@ page contentType="text/html; charset=gb2312" %>这句话
调用URLEncoder.encode(表单值)传送,应该就没问题了,以前我有遇到类似情况。