]> xmof Git - DeDRM.git/commitdiff
Obok: Fix invalid UTF-8 causing UI to not open
authorBrose Johnstone <baby-bell@users.noreply.github.com>
Sun, 30 Jan 2022 06:23:23 +0000 (22:23 -0800)
committernoDRM <no_drm123@protonmail.com>
Fri, 18 Mar 2022 15:50:22 +0000 (15:50 +0000)
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

index 403db271f2becc090efc38bf2d906639140cc68c..e95e8d16a14bf9028dacdca5c5f2be1d043d3b01 100644 (file)
@@ -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 = []