Commit 4463ced8 by Brian Coca

simpler safe output

parent de792ba3
...@@ -236,12 +236,13 @@ class Display: ...@@ -236,12 +236,13 @@ class Display:
def _safe_output(self, msg, stderr=False): def _safe_output(self, msg, stderr=False):
encoding='utf-8'
if not stderr and sys.stdout.encoding: if not stderr and sys.stdout.encoding:
msg = to_bytes(msg, sys.stdout.encoding) encoding = sys.stdout.encoding
elif stderr and sys.stderr.encoding: elif stderr and sys.stderr.encoding:
msg = to_bytes(msg, sys.stderr.encoding) encoding = sys.stderr.encoding
else:
msg = to_bytes(msg) msg = to_bytes(msg, encoding)
return msg return msg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment