Remove UTF-8 BOM from .py files when loading from the zip plugin

This commit is contained in:
Kovid Goyal 2020-10-03 14:14:05 +05:30
parent defa85e918
commit 0d3a80e850
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -158,7 +158,7 @@ class CalibrePluginLoader:
except Exception: except Exception:
# Maybe the zip file changed from under us # Maybe the zip file changed from under us
src = zf.read(zinfo.filename) src = zf.read(zinfo.filename)
return src.decode('utf-8').replace('\r\n', '\n') return src.decode('utf-8-sig').replace('\r\n', '\n')
def get_filename(self, fullname): def get_filename(self, fullname):
return self.filename return self.filename