From 65e1e1867c30fc70e4963df7f5bd9a15acf54a68 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 30 Sep 2015 13:00:23 -0400 Subject: [PATCH] Force utf8 encoding on subunit attachments output On certain environments if the locale is set to ASCII when printing an attachment things will explode because it's potentially trying to use unicode chars outside of ASCII. This commit forces the attachment output to be unicode encoded to avoid this issue. Change-Id: I79ff7482ec3b1fd3ce83b8acf3137119b3db39a9 Closes-Bug: #1501415 --- os_testr/subunit_trace.py | 1 + 1 file changed, 1 insertion(+) diff --git a/os_testr/subunit_trace.py b/os_testr/subunit_trace.py index 003299f..315d850 100755 --- a/os_testr/subunit_trace.py +++ b/os_testr/subunit_trace.py @@ -120,6 +120,7 @@ def print_attachments(stream, test, all_channels=False): # indent attachment lines 4 spaces to make them visually # offset for line in detail.as_text().split('\n'): + line = line.encode('utf8') stream.write(" %s\n" % line)