I'm trying to convert Java Strings into their various encoding types and print it out.
For example, luke would be 6C 75 6B 65 in UTF-8 and UTF-16 while the Chinese character 猪 would would be E7 8C AA in UTF-8 and 732A in UTF-16.
How do I write a function that does that?
new String( org.apache.commons.codec.binary.Hex.encodeHex(str.getBytes("UTF-16")));
doesn't seem to work for UTF-16.
lukewould be00 6C 00 75 00 6B 00 65.6C 75 6B 65would be汵步.