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
but it didn't workCode:byte [] b = str.getBytes( "UTF-8" /* encoding */ ); String t = new String( b, "UTF-8" /* encoding */ );
I have also tried the following code
but it didnt work.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();
Can someone explain me what should be my approach, how I can identify the charset and convert accordinly?
Thank you


Reply With Quote
Bookmarks