2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-12 18:59:06 +00:00

Harden confetty to weird text strings

If it can't properly encode to printable, use repr instead.
This commit is contained in:
Jarrod Johnson 2017-09-28 16:20:19 -04:00
parent 529e3b2239
commit 563ee96879

View File

@ -291,7 +291,10 @@ def print_result(res):
elif type(res[key]) == list:
attrstr = '%s=%s' % (key, recurse_format(res[key]))
elif not isinstance(res[key], dict):
print '{0}: {1}'.format(key, res[key])
try:
print '{0}: {1}'.format(key, res[key])
except UnicodeEncodeError:
print '{0}: {1}'.format(key, repr(res[key]))
continue
elif 'value' in res[key] and res[key]['value'] is not None:
attrstr = '%s="%s"' % (key, res[key]['value'])