[diffoscope] 01/01: Write trydiffoscope console output as UTF-8, even if STDOUT claims it doesn't support it.

Chris Lamb chris at chris-lamb.co.uk
Sun Aug 14 14:05:57 CEST 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit f0254870cf63bc7b3dda76df4da623d4915af511
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Aug 14 13:05:52 2016 +0100

    Write trydiffoscope console output as UTF-8, even if STDOUT claims it doesn't support it.
---
 bin/trydiffoscope | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bin/trydiffoscope b/bin/trydiffoscope
index 0fe6e93..f3d6f55 100755
--- a/bin/trydiffoscope
+++ b/bin/trydiffoscope
@@ -18,6 +18,7 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <http://www.gnu.org/licenses/>.
 
+import io
 import os
 import sys
 import time
@@ -134,6 +135,9 @@ if __name__ == '__main__':
         if not os.path.exists(x):
             parser.error("{}: does not exist".format(x))
 
+    if sys.stdout.encoding != 'UTF-8':
+        sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='UTF-8')
+
     try:
         sys.exit(TryDiffoscope(args).main())
     except KeyboardInterrupt:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list