]> git.etc.gen.nz Git - whoisi.git/commitdiff
Make sure that we talk UNICODE to the database.
authorAndrew Ruthven <andrew@etc.gen.nz>
Tue, 23 Jun 2009 23:58:37 +0000 (11:58 +1200)
committerAndrew Ruthven <andrew@cerberus.etc.gen.nz>
Tue, 23 Jun 2009 23:58:37 +0000 (11:58 +1200)
services/command/database.py

index e096563a344e49b4f62e2b2f771e78b106dd4f99..4de58b993e51aba3aaeb75b09dfd99b770c59053 100644 (file)
@@ -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)