From f86b19f8f728e1460d1d6c1f2b6d64f6db9befe3 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@cd1c1023-2f26-0410-ae45-c471fc1f0318> Date: Sat, 22 Dec 2007 08:05:40 +0000 Subject: [PATCH] skip bad utf-8 for users git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@927 cd1c1023-2f26-0410-ae45-c471fc1f0318 --- libraries/databaseTools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/databaseTools.py b/libraries/databaseTools.py index 88b7728f3..84f390c45 100644 --- a/libraries/databaseTools.py +++ b/libraries/databaseTools.py @@ -221,7 +221,6 @@ class etpDatabase: # if the database is opened readonly, we don't need to lock the online status self.connection = sqlite.connect(dbFile) self.cursor = self.connection.cursor() - # set the table read only return if (self.readOnly): @@ -2108,6 +2107,11 @@ class etpDatabase: self.createContentIndex() # FIXME: remove this with 1.0 + # protect user from having a bad day + # developers can solve bad utf-8 data (and MUST), so we won't skip bad chars for them + if self.clientDatabase: + self.connection.text_factory = lambda x: unicode(x, "utf-8", "ignore") + extstring = '' if extended: extstring = ",type"