You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/08/27 14:54:55 UTC

[incubator-openwhisk-package-kafka] branch master updated: Remove encoding check (#279)

This is an automated email from the ASF dual-hosted git repository.

dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-kafka.git


The following commit(s) were added to refs/heads/master by this push:
     new 1001c71  Remove encoding check (#279)
1001c71 is described below

commit 1001c71a520e26eef7bd270eb2a9f1d242b148fe
Author: Adnan Baruni <ab...@users.noreply.github.com>
AuthorDate: Mon Aug 27 09:54:53 2018 -0500

    Remove encoding check (#279)
    
    * remove encoding check
    
    * remove explicit string escaping when failure to encode as json
---
 provider/consumer.py | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/provider/consumer.py b/provider/consumer.py
index 3819072..4bf62cf 100644
--- a/provider/consumer.py
+++ b/provider/consumer.py
@@ -450,13 +450,6 @@ class ConsumerProcess (Process):
         return offsets
 
     def __encodeMessageIfNeeded(self, value):
-        # let's make sure whatever data we're getting is utf-8 encoded
-        try:
-            value = value.encode('utf-8')
-        except UnicodeDecodeError:
-            logging.warn('[{}] Value contains non-unicode bytes. Replacing invalid bytes.'.format(self.trigger))
-            value = unicode(value, errors='replace').encode('utf-8')
-
         if self.encodeValueAsJSON:
             try:
                 parsed = json.loads(value)
@@ -465,7 +458,6 @@ class ConsumerProcess (Process):
             except ValueError:
                 # no big deal, just return the original value
                 logging.warn('[{}] I was asked to encode a message as JSON, but I failed.'.format(self.trigger))
-                value = "\"{}\"".format(value)
                 pass
         elif self.encodeValueAsBase64:
             try: