Java converting byte array to string UTF-8
13,366
Try this instead:
String str = new String(bytes, Charset.forName("UTF8"));
Author by
Phil
Updated on June 04, 2022Comments
-
Phil almost 2 years
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