From 1e963106fe28f89db706cd058dbcfb1b0f66f1f5 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 9 Oct 2019 11:03:30 -0400 Subject: [PATCH] Fix unicode issues with web api --- confluent_server/confluent/httpapi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index a03ea80f..a4f1cd69 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -452,6 +452,8 @@ def resourcehandler_backend(env, start_response): httpsessions[authorized['sessionid']]['inflight'])): pagecontent += rsp start_response("200 OK", headers) + if not isinstance(pagecontent, bytes): + pagecontent = pagecontent.encode('utf-8') yield pagecontent return except exc.ConfluentException as e: @@ -654,6 +656,8 @@ def resourcehandler_backend(env, start_response): for datum in _assemble_json(hdlr, resource, url, extension): pagecontent += datum start_response('200 OK', headers) + if not isinstance(pagecontent, bytes): + pagecontent = pagecontent.encode('utf-8') yield pagecontent except exc.ConfluentException as e: if ((not isinstance(e, exc.LockedCredentials)) and