public static byte[] encode(String str) {
        return Utf8.toBytes(str);
    }
Helper class for conversion between String and UTF-8 representations.
vespajlib/src/main/java/com/yahoo/slime/Utf8Codec.java