Convert a String to a byte array and then back to the original String
I would suggest using the members of string, but with an explicit encoding: byte[] bytes = text.getBytes(“UTF-8”); String text = new String(bytes, “UTF-8”); By using an explicit encoding (and one which supports all of Unicode) you avoid the problems of just calling text.getBytes() etc: You’re explicitly using a specific encoding, so you know which encoding … Read more