I 'm using following data to decode the UTF-8 encoded String.
Actual string: 秦世俊:用“心”工作 找到属于自己的成就感【开讲啦 20160430】T
UTF-8 encoded: 秦ä¸ä¿ï¼ç¨âå¿âå·¥ä½ æ¾å°å±äºèªå·±çæå°±æãå¼è®²å¦ 20160430ã"
. Output is same as input. What is the issue?
Method:
public String decodeString(String encodedString) {
return new String(encodedString.getBytes(), "UTF-8");
}
Just Use String result = URLDecoder.decode(string, "UTF-8");
Or use this
byte[] data = Base64.decode(base64, Base64.DEFAULT);
String text = new String(data, "UTF-8");
use this
String s2 = new String(bytes, "UTF-8"); // Charset with which bytes were encoded
and if it doesn't work for you
String decoded = new String(encoded.getBytes("ISO-8859-1"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With