Merge pull request #726 from nakamuray/fix-source_to_unicode_py3_compatibility
fix source_to_unicode py3 compatibility
This commit is contained in:
commit
454c8de7b1
2 files changed
+11
-1
No files matched your search
+1
-1
@@ -128,7 +128,7 @@ def source_to_unicode(source, encoding=None):
|
||||
# UTF-8 byte-order mark
|
||||
return 'utf-8'
|
||||
|
||||
first_two_lines = re.match(r'(?:[^\n]*\n){0,2}', str(source)).group(0)
|
||||
first_two_lines = re.match(r'(?:[^\n]*\n){0,2}', source.decode('iso-8859-1')).group(0)
|
||||
possible_encoding = re.search(r"coding[=:]\s*([-\w.]+)",
|
||||
first_two_lines)
|
||||
if possible_encoding:
|
||||
|
||||
Reference in new issue
Block a user