public String GB2312ToUnicode(String s) {
String s1="";
if(s!=null && !s.equals("")) {
try {
String s2 = new String(s.getBytes(),"gb2312");
s = s2;
int i = s.length();
for(int j = 0; j<i; j++) {
char c = s.charAt(j);
if (c == '\n'){
s1 = s1 + "<br/>";
}else{
s1 = s1 + "&#x" + Integer.toHexString(c)+";";
}
}
}catch(Exception e){ e.printStackTrace();}
}
return s1;
}
String s1="";
if(s!=null && !s.equals("")) {
try {
String s2 = new String(s.getBytes(),"gb2312");
s = s2;
int i = s.length();
for(int j = 0; j<i; j++) {
char c = s.charAt(j);
if (c == '\n'){
s1 = s1 + "<br/>";
}else{
s1 = s1 + "&#x" + Integer.toHexString(c)+";";
}
}
}catch(Exception e){ e.printStackTrace();}
}
return s1;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货