You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shouldn't this be -
byte[] b = string.getBytes();
byte[] b = string.getBytes(Charset.forName("UTF-8"));
byte[] b = string.getBytes(StandardCharsets.UTF_8); // Java 7+ only
Also shouldn't it be encode ? why decode ?
The text was updated successfully, but these errors were encountered:
private byte[] stringToBytes(String string) {
byte[] bytes;
bytes = null;
try {
bytes = Base64.decode(string, Base64.DEFAULT);
} catch(IllegalArgumentException e) {
e.printStackTrace();
}
return bytes;
}
Shouldn't this be -
byte[] b = string.getBytes();
byte[] b = string.getBytes(Charset.forName("UTF-8"));
byte[] b = string.getBytes(StandardCharsets.UTF_8); // Java 7+ only
Also shouldn't it be encode ? why decode ?
The text was updated successfully, but these errors were encountered: