I use the following data to decode a UTF-8 encoded string.
Actual line: 秦世俊: 用 "心" 工作 找到 属于 自己 的 成就感 【开讲 20160430】 T
UTF-8 encoded: |§ | 20160430ã "
. The output is the same as the input. What is the problem?
Method:
public String decodeString(String encodedString) { return new String(encodedString.getBytes(), "UTF-8"); }
Just use String result = URLDecoder.decode(string, "UTF-8");
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 does not work for you
String decoded = new String(encoded.getBytes("ISO-8859-1"));
Source: https://habr.com/ru/post/1655613/More articles:Cannot read URL error for angular2 dynamic components with Url pattern - angularConfigure Cordova fastlane xcode 8 profile - iosAsp.net ID - Reset cookie and session on iis recycle (reload) - c #Ошибка условного вызова обратного вызова ActiveRecord - rubyКак сделать все экземпляры в Java что-то - javaNSSharingService assigns CC and BCC recipients in the default MAC application. Default email - emailHow to distinguish a translation does not exist or is the translation the same as the source? - c ++количество групп и подгрупп mongodb - mongodbScala Compiler (2.11.7) Anomaly with JSON Writes - jsonuser maximizes battery return - listAll Articles