From 709ad1db1e477c0765310886f9a5f26870854469 Mon Sep 17 00:00:00 2001 From: Robert Tice Date: Wed, 10 Jul 2019 13:28:22 -0400 Subject: [PATCH] Adding string decoding to all outputs to avoid python errors when programs try to print unprintable characters. Instead, a suitable replacement is picked using the 'replace' operation in the python decode function. --- infrastructure/container_payload/run.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infrastructure/container_payload/run.py b/infrastructure/container_payload/run.py index 46b1233..f10ff9b 100644 --- a/infrastructure/container_payload/run.py +++ b/infrastructure/container_payload/run.py @@ -60,7 +60,9 @@ def json_print(pdict): def print_generic(msg, tag, lab_ref): - obj = {"msg": msg} + decoded_msg = msg.decode(encoding='utf-8', errors='replace') + + obj = {"msg": decoded_msg} if lab_ref: obj["lab_ref"] = lab_ref json_print({tag: obj})