mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Linux binary: Do not fail on system with invalid locale info. Instead default to using the UTF-8 encoding on these systems. Fixes #1343444 [calibre crash with utf_8_valencia](https://bugs.launchpad.net/calibre/+bug/1343444)
This commit is contained in:
parent
ba75506ee3
commit
4b8f7184fb
@ -337,7 +337,10 @@ class LinuxFreeze(Command):
|
||||
enc = locale.nl_langinfo(locale.CODESET)
|
||||
if not enc or enc.lower() == 'ascii':
|
||||
enc = 'UTF-8'
|
||||
enc = codecs.lookup(enc).name
|
||||
try:
|
||||
enc = codecs.lookup(enc).name
|
||||
except LookupError:
|
||||
enc = 'UTF-8'
|
||||
sys.setdefaultencoding(enc)
|
||||
del sys.setdefaultencoding
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user