##// END OF EJS Templates
import-checker: open all source files as utf-8...
Gregory Szorc -
r43733:a8454e84 stable
parent child Browse files
Show More
@@ -4,6 +4,7 b' from __future__ import absolute_import, '
4
4
5 import ast
5 import ast
6 import collections
6 import collections
7 import io
7 import os
8 import os
8 import sys
9 import sys
9
10
@@ -754,7 +755,11 b' def sources(f, modname):'
754 yield src.read(), modname, f, 0
755 yield src.read(), modname, f, 0
755 py = True
756 py = True
756 if py or f.endswith('.t'):
757 if py or f.endswith('.t'):
757 with open(f, 'r') as src:
758 # Strictly speaking we should sniff for the magic header that denotes
759 # Python source file encoding. But in reality we don't use anything
760 # other than ASCII (mainly) and UTF-8 (in a few exceptions), so
761 # simplicity is fine.
762 with io.open(f, 'r', encoding='utf-8') as src:
758 for script, modname, t, line in embedded(f, modname, src):
763 for script, modname, t, line in embedded(f, modname, src):
759 yield script, modname.encode('utf8'), t, line
764 yield script, modname.encode('utf8'), t, line
760
765
General Comments 0
You need to be logged in to leave comments. Login now