summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isort/isort.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/isort/isort.py b/isort/isort.py
index f9d750d6..0ec78206 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -756,6 +756,7 @@ def coding_check(fname, default='utf-8'):
# see https://www.python.org/dev/peps/pep-0263/
pattern = re.compile(br'coding[:=]\s*([-\w.]+)')
+ coding = default
with io.open(fname, 'rb') as f:
for line_number, line in enumerate(f, 1):
groups = re.findall(pattern, line)
@@ -763,7 +764,6 @@ def coding_check(fname, default='utf-8'):
coding = groups[0].decode('ascii')
break
if line_number > 2:
- coding = default
break
return coding