Fix encoding detection.

This commit is contained in:
Romain Failliot 2016-08-26 08:20:29 -04:00
parent 67d801da79
commit c46506f1d6
1 changed files with 3 additions and 2 deletions

View File

@ -1124,8 +1124,9 @@ class Preferences:
'utf32': [ codecs.BOM_UTF32_BE, codecs.BOM_UTF32_LE ] } 'utf32': [ codecs.BOM_UTF32_BE, codecs.BOM_UTF32_LE ] }
for encoding in self._getDefaultEncodings(): for encoding in self._getDefaultEncodings():
try: try:
for m in magic.get(encoding.lower().replace('-', '').replace('_', ''), [ '' ]): encoding = encoding.lower().replace('-', '').replace('_', '')
if str(s).startswith(m): for m in magic.get(encoding, [ b'' ]):
if s.startswith(m):
break break
else: else:
continue continue