JAVA中,默认的编码方式是unicode,所以你在输出到页面之前应把所有字符串的编码格式转换,使用下面的函数:
public String transCode(String chi){
String result=null;
byte[] temp;
try{
temp=chi.getBytes("iso-8859-1");
result=new String(temp);
}
catch(UnsupportedEncodingException e){
return null;
}
return result;
}
public String transCode(String chi){
String result=null;
byte[] temp;
try{
temp=chi.getBytes("iso-8859-1");
result=new String(temp);
}
catch(UnsupportedEncodingException e){
return null;
}
return result;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货