While convert UCS2 into UTF-8, I hit UnsupportedEncodingException. So I use UTF-16 instead and it work well (at least till the time I write this post):
public String ucs2ToUTF8(byte[] ucs2Bytes) throws UnsupportedEncodingException{
String unicode = new String(ucs2Bytes, "UTF-16");
String utf8 = new String(unicode.getBytes("UTF-8"), "Cp1252");
return utf8;
}
1 comment:
Thanks. The UTF16 solved my issue as well, but not the UTF8.
Post a Comment