private String extractEncoding(Headers headers) {
        Header header = headers.lastHeader(HEADER_ENCODING);
        if (header == null) {
            throw new DataException("Header '" + HEADER_ENCODING + "' is required!");
        }

        return new String(header.value());
    }
This is a simple Converter implementation that uses "encoding" header to encode/decode strings via provided charset name
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/SampleConverterWithHeaders.java