Difference between UTF-8 and UTF-16?

Difference between UTF-8 and UTF-16? Why do we need these?

MessageDigest md = MessageDigest.getInstance("SHA-256");
String text = "This is some text";

md.update(text.getBytes("UTF-8")); // Change this to "UTF-16" if needed
byte[] digest = md.digest();


Read more here: https://stackoverflow.com/questions/4655250/difference-between-utf-8-and-utf-16

Content Attribution

This content was originally published by theJava at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: