From 0fec40c3b4c621ee21a88906e77c6ea7a56cb8a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20M=C3=A9heut?= Date: Sun, 10 Jan 2016 20:55:15 +0100 Subject: [PATCH 1/2] Changed connection to SQlite db to support different encoded charsets --- utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils.py b/utils.py index c391a43..e589abe 100644 --- a/utils.py +++ b/utils.py @@ -166,6 +166,7 @@ def SaveToDb(result): logfile = os.path.join(settings.Config.ResponderPATH, 'logs', fname) cursor = sqlite3.connect(settings.Config.DatabaseFile) + cursor.text_factory = sqlite3.Binary res = cursor.execute("SELECT COUNT(*) AS count FROM responder WHERE module=? AND type=? AND LOWER(user)=LOWER(?)", (result['module'], result['type'], result['user'])) (count,) = res.fetchone() From f0257bc919d687e2edddc52f5a396f9e6ebef1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yannick=20M=C3=A9heut?= Date: Sun, 10 Jan 2016 20:57:38 +0100 Subject: [PATCH 2/2] Comments to explain use of cursor.text_factory --- utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/utils.py b/utils.py index e589abe..45510cf 100644 --- a/utils.py +++ b/utils.py @@ -166,6 +166,7 @@ def SaveToDb(result): logfile = os.path.join(settings.Config.ResponderPATH, 'logs', fname) cursor = sqlite3.connect(settings.Config.DatabaseFile) + # We add a text factory to support different charsets cursor.text_factory = sqlite3.Binary res = cursor.execute("SELECT COUNT(*) AS count FROM responder WHERE module=? AND type=? AND LOWER(user)=LOWER(?)", (result['module'], result['type'], result['user'])) (count,) = res.fetchone()