From 9868e559581c466c625b3cdebf9e5863dc3381bc Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 21 Oct 2015 13:24:41 -0400 Subject: [PATCH] Handle unicode string from a console plugin If a console plugin feels like outputting data in a unicode string, accept that data by encoding to utf-8. --- confluent_server/confluent/consoleserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/consoleserver.py b/confluent_server/confluent/consoleserver.py index 0e0bdeaa..c71cfe7d 100644 --- a/confluent_server/confluent/consoleserver.py +++ b/confluent_server/confluent/consoleserver.py @@ -365,7 +365,10 @@ class _ConsoleHandler(object): eventdata |= 2 self.log(data, eventdata=eventdata) self.lasttime = util.monotonic_time() - self.buffer += data + if isinstance(data, bytearray) or isinstance(data, bytes): + self.buffer += data + else: + self.buffer += data.encode('utf-8') #TODO: analyze buffer for registered events, examples: # panics # certificate signing request