From 860b5737b7d6fda0d34da4636a14662373dc490d Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sun, 24 Jan 2010 19:59:49 +0200 Subject: [PATCH] Use common encoding routine everywhere The string/locale manipulation in Database.py was open-coded and did not use Charset.to_utf8() like the rest of the code. --- pyfpdb/Database.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 28f5f7a5..fc989870 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -38,7 +38,6 @@ from decimal import Decimal import string import re import Queue -import codecs # pyGTK modules @@ -52,7 +51,6 @@ import Charset from Exceptions import * log = Configuration.get_logger("logging.conf") -encoder = codecs.lookup('utf-8') class Database: @@ -1561,7 +1559,7 @@ class Database: def insertPlayer(self, name, site_id): result = None - (_name, _len) = encoder.encode(unicode(name)) + _name = Charset.to_utf8(name) c = self.get_cursor() q = "SELECT name, id FROM Players WHERE siteid=%s and name=%s" q = q.replace('%s', self.sql.query['placeholder'])