From b03bde9d73c30680c0e0f838a7f2f2e43b140945 Mon Sep 17 00:00:00 2001 From: Brose Johnstone Date: Sat, 29 Jan 2022 22:23:23 -0800 Subject: [PATCH] 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. --- Obok_plugin/obok/obok.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Obok_plugin/obok/obok.py b/Obok_plugin/obok/obok.py index e80e9ae..35b202e 100644 --- a/Obok_plugin/obok/obok.py +++ b/Obok_plugin/obok/obok.py @@ -424,6 +424,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 = []