title: Getting some prefix or postfix characters with message
body: <p>i am new in kafka and i have created a sample consumer in java for getting data from kafka topic but when i consuming the message, arrives with additional string or characters like with some special characters (?????Xmydata) like this. </p>
  
  <p>if i am not using right code please provide me appropriate code.</p>
  
  <pre><code>The code i am using..
  
          getting output = ?????mydata
          expected output = mydata 
  
  
  
  
           public static void main(String[] args) throws Exception {
                  Properties props = new Properties();
                  props.put("bootstrap.servers", "localhost:9092");
                  props.put("group.id", "mysql-joined-datalist2");
                  props.put("auto.commit.interval.ms", "1000");
                  props.put("enable.auto.commit", "true");
                  props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
                  props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
  
                  //kafka consumer object
                  KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;String, String&gt;(props);
  
                  //subscribe to topic
                  consumer.subscribe(Arrays.asList("mysql-joined-datalist2"));
  
                  //infinite poll loop
                  while (true) {
                      ConsumerRecords&lt;String, String&gt; records = consumer.poll(0);
                      for (ConsumerRecord&lt;String, String&gt; record : records) {
  
                          String payload = record.value();
          //                InputStream is = new ByteArrayInputStream(payload.getBytes("UTF-8"));
                          String oldString = record.value();
                          String newString = new String(oldString.getBytes("UTF-8"), "UTF-8");
                          System.out.println("newString : " + newString);
                          String s2 = new String(record.value().getBytes("ISO-8859-1"),"UTF-8");
                           System.out.println("str : "+s2); // output = str : ?????Xmydata
          }
  
  
  
          please help me. thanks in advanced.
  </code></pre>