import java.io.*;
public class MyUtil{
public static String big5ToUnicode(String s){
try{
return new String(s.getBytes("ISO8859_1"), "Big5");
}
catch (UnsupportedEncodingException uee){
return s;
}
}
public static String UnicodeTobig5(String s){
try{
return new String(s.getBytes("Big5"), "ISO8859_1");
}
catch (UnsupportedEncodingException uee){
return s;
}
}
public static String toHexString(String s){
String str="";
for (int i=0; i<s.length(); i++){
int ch=(int)s.charAt(i);
String s4="0000"+Integer.toHexString(ch);
str=str+s4.substring(s4.length()-4)+" ";
}
return str;
}
}
|