[chrome-gnome-shell/feature/python3] python3: always count bytes (not chars) when sending message



commit 122907c0c2e5f362d5a4a6b9e7cca7694783f35e
Author: Yuri Konotopov <ykonotopov gmail com>
Date:   Sun Mar 27 12:46:57 2016 +0300

    python3: always count bytes (not chars) when sending message

 connector/gs-chrome-connector.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/connector/gs-chrome-connector.py b/connector/gs-chrome-connector.py
index 5e6bd11..82c65c2 100755
--- a/connector/gs-chrome-connector.py
+++ b/connector/gs-chrome-connector.py
@@ -38,7 +38,7 @@ def isUUID(uuid):
 # Helper function that sends a message to the webapp.
 def send_message(response):
     message = json.dumps(response)
-    message_length = len(message)
+    message_length = len(message.encode('utf-8'))
 
     if message_length > 1024*1024:
         logError('Too long message (%d): "%s"' % (message_length, message))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]