diff --git a/monasca_common/kafka/producer.py b/monasca_common/kafka/producer.py
index <HASH>..<HASH> 100644
--- a/monasca_common/kafka/producer.py
+++ b/monasca_common/kafka/producer.py
@@ -16,6 +16,7 @@
 import logging
 import time
 
+from oslo_utils import encodeutils
 from six import PY3
 
 import monasca_common.kafka_lib.client as kafka_client
@@ -53,11 +54,11 @@ class KafkaProducer(object):
         success = False
         if key is None:
             key = int(time.time() * 1000)
-        if PY3:
-            key = bytes(str(key), 'utf-8')
-            messages = [m.encode("utf-8") for m in messages]
-        else:
-            key = str(key)
+
+        messages = [encodeutils.to_utf8(m) for m in messages]
+
+        key = bytes(str(key), 'utf-8') if PY3 else str(key)
+
         while not success:
             try:
                 self._producer.send_messages(topic, key, *messages)
Ensures that messages pass to kafka client are bytes string

Story: <I>
Task: <I>

Change-Id: I3ae<I>fbbe<I>bf<I>d<I>c<I>dda<I>d<I>