title: Does Kafka change binary data?
body: <p>I have some serialized AVRO data (mix of printable and not printable character) in the file data.bin and I send it by Kafka console client to the topic called topicname. When I read it by the console client (or my java code) from the topic, the data are corrupted. Text is ok but not printable characters are not.</p>
  
  <p><strong>PRODUCER:</strong></p>
  
  <pre><code>user@server$ cat data.bin                            --------------- binary data, serialized AVRO (mix of printable and not printable characters)
  ▒▒▒▒▒▒XBADVANCED....
  
  user@server$ hexdump data.bin
  0000000 0000 0100 00ff 0000 0202 0200 a286 a882
  0000010 58f7 0000 0000 0000 0002 0202 4142 5644
  .......
  
  user@server$ ./kafka-console-producer.sh --broker-list server:port --topic topicname &lt; data.bin
  JAVA HOME:
  user@server$
  </code></pre>
  
  <p>Then I try to read it by the console consumer from the topic:</p>
  
  <p><strong>CONSUMER:</strong></p>
  
  <pre><code>user@server$ ./kafka-console-consumer.sh --bootstrap-server server:port --topic topicname
  JAVA HOME:
  ������XBADVANCED.....                                      -----------  see the not prinable data at the beginning, they are different the the original, the printable characters are ok
  ^CProcessed a total of 1 messages
  
  
  user@server$ ./kafka-console-consumer.sh --bootstrap-server server:port --topic topicname &gt; outputdata.bin
  ^CProcessed a total of 1 messages
  dev@pardbd3:bin$ hexdump outputdata.bin
  0000000 414a 4156 4820 4d4f 3a45 0a20 0000 0100             ----------- it starts with "JAVA HOME:" string, real begin of the data is 0000 0100 bfef 00bd 0000 0202 0200 bfef efbd bdbf ....  
  0000010 bfef 00bd 0000 0202 0200 bfef efbd bdbf
  .....
  </code></pre>
  
  <p>As you can see text part of the data is ok but not printable characters are transformed to another not printable characters. What is the problem, is there any Kafka configuration which may cause this issue?</p>