I'm trying to convert a byte array to a string. The problem is that UTF-8 won't work. I can't show "ü", "ä" or something like this. Can anyone help me?
public static String byteToString(byte[] bytes) {
String str = new String(bytes, Charsets.UTF_8);
return str;
}
Would be nice if it works down until API 8 Android
1 Answer 1
Try this instead:
String str = new String(bytes, Charset.forName("UTF8"));
answered Jul 14, 2014 at 5:22
morgano
17.5k11 gold badges48 silver badges57 bronze badges
Sign up to request clarification or add additional context in comments.
lang-java
new String(bytes, "UTF-8");?