From 0d2138a4a07f12267c611264726b93b43711ed80 Mon Sep 17 00:00:00 2001 From: stamparm Date: Mon, 25 Feb 2013 14:06:46 +0100 Subject: [PATCH] Minor fix for escaping unicode strings in SQLite escaper --- plugins/dbms/sqlite/syntax.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/dbms/sqlite/syntax.py b/plugins/dbms/sqlite/syntax.py index 6b2cec7c3..5e0144289 100644 --- a/plugins/dbms/sqlite/syntax.py +++ b/plugins/dbms/sqlite/syntax.py @@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission import binascii from lib.core.common import isDBMSVersionAtLeast +from lib.core.settings import UNICODE_ENCODING from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): @@ -17,7 +18,7 @@ class Syntax(GenericSyntax): @staticmethod def escape(expression, quote=True): def escaper(value): - return "CAST(X'%s' AS TEXT)" % binascii.hexlify(value) + return "CAST(X'%s' AS TEXT)" % binascii.hexlify(value.encode(UNICODE_ENCODING) if isinstance(value, unicode) else value) retVal = expression