summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrose Johnstone <[email protected]>2022-01-29 22:23:23 -0800
committernoDRM <[email protected]>2022-03-18 15:50:22 +0000
commit1f13ae0f78cbc98b4b004014476590179c979847 (patch)
tree7586052e388807ab79cfbdf93289bcf906179b0f
parentc5aebcca016f96520dc941651a49992472a4f0e4 (diff)
Obok: Fix invalid UTF-8 causing UI to not open
For some reason, the title of a book on my device causes Obok to choke. Apparently it's not valid UTF-8. This fixes that by ignoring decode errors.
-rw-r--r--Obok_plugin/obok/obok.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Obok_plugin/obok/obok.py b/Obok_plugin/obok/obok.py
index 403db27..e95e8d1 100644
--- a/Obok_plugin/obok/obok.py
+++ b/Obok_plugin/obok/obok.py
@@ -352,6 +352,7 @@ class KoboLibrary(object):
olddb.close()
self.newdb.close()
self.__sqlite = sqlite3.connect(self.newdb.name)
+ self.__sqlite.text_factory = lambda b: b.decode("utf-8", errors="ignore")
self.__cursor = self.__sqlite.cursor()
self._userkeys = []
self._books = []