From: Andrew Ruthven Date: Tue, 23 Jun 2009 23:58:37 +0000 (+1200) Subject: Make sure that we talk UNICODE to the database. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6df72c09820522073d551e53170d7d24060b3522;p=whoisi.git Make sure that we talk UNICODE to the database. --- diff --git a/services/command/database.py b/services/command/database.py index e096563..4de58b9 100644 --- a/services/command/database.py +++ b/services/command/database.py @@ -26,9 +26,15 @@ class DatabaseCommandManager: def __init__(self): self.db = None + + def db_set_encoding(self, con): + cursor = con.cursor() + cursor.execute("SET CLIENT_ENCODING TO UNICODE") + def start(self, connection_type, connection_dict): if self.db is None: + connection_dict['cp_openfun'] = self.db_set_encoding self.db = adbapi.ConnectionPool(connection_type, **connection_dict)