The list of methods to do UTF8 Encode are organized into topic(s).
String
encodeUtf8(byte[] bytes) encode Utf
try {
return bytes == null ? null : new String(bytes, UTF8);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Could not convert bytes to UTF-8 string", e);
byte[]
encodeUTF8(String str) Convenience method for encoding a UTF-8 byte string from a Java String .
try {
return str.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 charset not found! This should not happen...", e);
String
encodeUtf8(String target) encode Utf
String result = null;
try {
result = new String(target.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
System.err.println("ERROR! encode utf8 failed - " + e);
return result;
byte[]
encodeUTF8(String text) encode UTF
try {
return text.getBytes(UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e);