Hi everyone
I hope someone can help me with this strange problem.
I have a string containing the following text
"[{\"id\":18273,\"name\":\"\u0410\u0430\u043b\u0435\u043d\"}""
As you can see the name is encoded but don't know what exactly it is.
After doing some research I found out that by passing this strin it will automatically convert it to the actual text but it doesn't in my case.
How can I convert the value of name so that it shows what the actual value is (which is russian I believe)
I've tried the following
Code:
byte [] b = str.getBytes( "UTF-8" /* encoding */ );
String t = new String( b, "UTF-8" /* encoding */ );
but it didn't work
I have also tried the following code
Code:
Charset charset = Charset.forName("UTF-8");
CharsetDecoder decoder = charset.newDecoder();
CharsetEncoder encoder = charset.newEncoder();
ByteBuffer bbuf = encoder.encode(uCharBuffer);
CharBuffer cbuf = decoder.decode(bbuf);
String s = cbuf.toString();
but it didnt work.
Can someone explain me what should be my approach, how I can identify the charset and convert accordinly?
Thank you