mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix printing of tracebacks broken when third party plugins with non-UTF-8 source code present
This commit is contained in:
parent
37fee2b5b2
commit
6ba70b06aa
@ -164,7 +164,11 @@ class CalibrePluginLoader:
|
||||
return src
|
||||
|
||||
def get_source(self, fullname=None):
|
||||
return self.get_source_as_bytes(fullname).decode('utf-8-sig').replace('\r\n', '\n')
|
||||
raw = self.get_source_as_bytes(fullname)
|
||||
try:
|
||||
return raw.decode('utf-8-sig', 'replace').replace('\r\n', '\n')
|
||||
except Exception:
|
||||
return ''
|
||||
|
||||
def get_filename(self, fullname):
|
||||
return self.filename
|
||||
|
Loading…
x
Reference in New Issue
Block a user