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
This commit is contained in:
Matthew Treinish 2015-09-30 13:00:23 -04:00
parent d577844b7b
commit 65e1e1867c
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 1 additions and 0 deletions

View File

@ -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)