Fix encoding detection.
This commit is contained in:
parent
67d801da79
commit
c46506f1d6
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue