mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-05 08:40:13 -04:00
Fix #2086237 [LookupError: unknown encoding mac-centraleurope](https://bugs.launchpad.net/calibre/+bug/2086237)
This commit is contained in:
parent
3e96e1375f
commit
afb2610676
@ -100,7 +100,7 @@ def find_declared_encoding(raw, limit=50*1024):
|
||||
return ans
|
||||
|
||||
|
||||
_CHARSET_ALIASES = {"macintosh" : "mac-roman", "x-sjis" : "shift-jis"}
|
||||
_CHARSET_ALIASES = {"macintosh" : "mac-roman", "x-sjis" : "shift-jis", 'mac-centraleurope': 'cp1250'}
|
||||
|
||||
|
||||
def detect(bytestring):
|
||||
@ -108,6 +108,7 @@ def detect(bytestring):
|
||||
bytestring = bytestring.encode('utf-8', 'replace')
|
||||
from calibre_extensions.uchardet import detect as implementation
|
||||
enc = implementation(bytestring).lower()
|
||||
enc = _CHARSET_ALIASES.get(enc, enc)
|
||||
return {'encoding': enc, 'confidence': 1 if enc else 0}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user