From 4b8f7184fb8ecfdfa7f6310680c449efa6507c77 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 18 Jul 2014 07:59:30 +0530 Subject: [PATCH] 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) --- setup/installer/linux/freeze2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/installer/linux/freeze2.py b/setup/installer/linux/freeze2.py index daae99cafb..c96457edfe 100644 --- a/setup/installer/linux/freeze2.py +++ b/setup/installer/linux/freeze2.py @@ -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