The String itself will always be in Unicode; I'm not sure what you mean by "convert this to Chinese text" but to convert it to the binary representation using UTF-8 you'd use:
byte[] bytes = unicode.getBytes("UTF-8");
or you can use the Charset
- using the Guava library for example, you'd just use:
byte[] bytes = unicode.getBytes(Charsets.UTF_8);
(This gets round the brittleness of specifying a string, and avoids worrying about catching UnsupportedEncodingException
.)
Or you can declare:
final static Charset UTF_8 = Charset.forName("UTF-8");
at the top of your class to avoid a whole library as a cure for the string.