From 959acc1f28f669b8f4ef2292ca8934eae3c4d445 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 8 Feb 2015 15:22:31 +0530 Subject: [PATCH] Remove BOM mark from litres plugin and also handle BOM mark when downloading plugins --- src/calibre/gui2/store/loader.py | 2 +- src/calibre/gui2/store/stores/litres_plugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/loader.py b/src/calibre/gui2/store/loader.py index 0c1efe8479..6da3e4fa01 100644 --- a/src/calibre/gui2/store/loader.py +++ b/src/calibre/gui2/store/loader.py @@ -37,7 +37,7 @@ def download_updates(ver_map={}, server='https://code.calibre-ebook.com'): name = name.decode('utf-8') d = decompressobj() src = d.decompress(raw) - src = src.decode('utf-8') + src = src.decode('utf-8').lstrip(u'\ufeff') # Python complains if there is a coding declaration in a unicode string src = re.sub(r'^#.*coding\s*[:=]\s*([-\w.]+)', '#', src, flags=re.MULTILINE) # Translate newlines to \n diff --git a/src/calibre/gui2/store/stores/litres_plugin.py b/src/calibre/gui2/store/stores/litres_plugin.py index 0c59b7e0de..f2c4e0ad99 100644 --- a/src/calibre/gui2/store/stores/litres_plugin.py +++ b/src/calibre/gui2/store/stores/litres_plugin.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- from __future__ import (unicode_literals, division, absolute_import, print_function) store_version = 1 # Needed for dynamic plugin loading