title: UTF8-mb4 in Kafka
body: <p>I have a UTF8-mb4 char in mongo and have a java extractor which extracts data from mongo and put into kafka. When the data goes to Kafka the special char has been replaced with \u...</p>
  <pre><code>Sample text:- &quot;\uDBFF\uDC15COMPANY&quot;
  </code></pre>
  <p>I have another Java program which reads from one kafka topic and put it into another kafka topic after some operation. When the data is read from the actual topic, the \u... is been decoded to an actual special char and when the data is pushed to the target topic, it is is like some junk char. How to put the data back to the target topic as \u ...</p>
  <p>The same message in the target topic is like,</p>
  <blockquote>
  <p>&quot;COMPANY&quot;</p>
  </blockquote>
  <p><strong>Note:-</strong></p>
  <p>The message has lots of data(JSON data) and there could be a special char in any json value.</p>
  <p>While reading from the source topic,</p>
  <p>For consumer to consume from the source topic,</p>
  <pre><code>key.deserializer = &quot;org.apache.kafka.common.serialization.ByteArrayDeserializer&quot;
  value.deserializer = &quot;org.apache.kafka.common.serialization.ByteArrayDeserializer&quot;
  </code></pre>
  <p>For produce to produce in the target topic,</p>
  <pre><code>key.serializer = &quot;org.apache.kafka.common.serialization.ByteArraySerializer&quot;
  value.serializer = &quot;org.apache.kafka.common.serialization.ByteArraySerializer&quot;
  </code></pre>