@Override
    public byte[] serialize(String topic, UUID data) {
        try {
            if (data == null)
                return null;
            else
                return data.toString().getBytes(encoding);
        } catch (UnsupportedEncodingException e) {
            throw new SerializationException("Error when serializing UUID to byte[] due to unsupported encoding " + encoding);
        }
    }
We are converting UUID to String before serializing. String encoding defaults to UTF8 and can be customized by setting
 the property key.deserializer.encoding, value.deserializer.encoding or deserializer.encoding. The first two take precedence over the last.
clients/src/main/java/org/apache/kafka/common/serialization/UUIDSerializer.java