From d712f947d9edc88fb361ad046bebb14ee4024ed6 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Fri, 17 Mar 2017 16:21:01 -0500 Subject: [PATCH] Always print using utf-8. Fixes #362 --- speedtest.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/speedtest.py b/speedtest.py index effaab9..1acfde1 100755 --- a/speedtest.py +++ b/speedtest.py @@ -148,8 +148,7 @@ except ImportError: Taken from https://pypi.python.org/pypi/six/ - Modified to set encoding to UTF-8 if not set when stdout may not be - a tty such as when piping to head + Modified to set encoding to UTF-8 always """ fp = kwargs.pop("file", sys.stdout) if fp is None: @@ -159,7 +158,7 @@ except ImportError: if not isinstance(data, basestring): data = str(data) # If the file has an encoding, encode unicode with it. - encoding = fp.encoding or 'UTF-8' # Diverges for notty + encoding = 'UTF-8' # Always trust UTF-8 for output if (isinstance(fp, file) and isinstance(data, unicode) and encoding is not None):