char hexDigit[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] };
return new String(array);
}
static public String charToHex(char c) {
byte hi = (byte) (c >>> 8);
byte lo = (byte) (c & 0xff);
return byteToHex(hi) + byteToHex(lo);
}
public String utfToISO(String st) {
byte a[];
String hex="";
String returnvalue="";
try {
for (int j=0;j<=st.length();j++)
{
hex="";
a=st.substring(j,j+1).getBytes("UTF-16");
for (int i=0;i
}
if (a[2]!=0) {
returnvalue+="";
returnvalue+=Integer.parseInt(hex, 16);
returnvalue+=";";
}
else returnvalue+=st.substring(j,j+1);
}
}
catch (Exception e) {}
return returnvalue;
}
No comments:
Post a Comment