I am trying to decode a string which may contain multiple UTF8(hex) encoding like this:
"IMPU=H\u’C3A9’tm\u’C3A9’rf\u’C3B6’ldescsizma,AC=IMPU,AC=C-NTDB".
I want to decode below string into a meaningful string.
I tried this :
String hex = "H\\u’C3A9’tm\\u’C3A9’rf\\u’C3B6’ldescsizma,DC=IMPU,DC=C-NTDB";
ByteBuffer buff = ByteBuffer.allocate(hex.length()/2);
for (int i = 0; i < hex.length(); i+=2) {
buff.put((byte)Integer.parseInt(hex.substring(i, i+2), 16));
}
buff.rewind();
Charset cs = Charset.forName("UTF-8");
CharBuffer cb = cs.decode(buff);
System.out.println(cb.toString());
Don't know how to proceed further, please let me know if anybody has any idea.