From 1ea9f12b18f720ce25f7acd70b8210e070dcad0f Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 5 May 2014 21:01:05 +0200 Subject: [PATCH] Assume UTF-8 when decoding hg or git output; closes #148 --- CHANGES.rst | 2 +- flake8/hooks.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index a509b87..591d870 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,7 +6,7 @@ CHANGES - New option ``doctests`` to run Pyflakes checks on doctests too - New option ``jobs`` to launch multiple jobs in parallel -- Fix Git and Mercurial hooks, issues #88 and #133 +- Fix Git and Mercurial hooks, issues #88, #133 and #148 - Fix crashes with Python 3.4 by upgrading dependencies - Fix traceback when running tests with Python 2.6 - Fix the setuptools command ``python setup.py flake8`` to read diff --git a/flake8/hooks.py b/flake8/hooks.py index 48f50b3..f53c8f0 100644 --- a/flake8/hooks.py +++ b/flake8/hooks.py @@ -125,10 +125,10 @@ def run(command, raw_output=False, decode=True): # endswith method. That should work but might still fail horribly. if hasattr(stdout, 'decode'): if decode: - stdout = stdout.decode() + stdout = stdout.decode('utf-8') if hasattr(stderr, 'decode'): if decode: - stderr = stderr.decode() + stderr = stderr.decode('utf-8') if not raw_output: stdout = [line.strip() for line in stdout.splitlines()] stderr = [line.strip() for line in stderr.splitlines()]