Code

Fix Issue2550609, hopefully for real, this time.
authorstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 24 Nov 2009 20:26:52 +0000 (20:26 +0000)
committerstefan <stefan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 24 Nov 2009 20:26:52 +0000 (20:26 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4388 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/backends/indexer_rdbms.py

index bb89ceca61240c0892e6bd3357e958f0b8d7218b..70e522b915823b11be46e5cfd3cca568791e92de 100644 (file)
@@ -64,11 +64,9 @@ class Indexer(IndexerBase):
             self.db.cursor.execute(sql, (id, ))
 
         # ok, find all the unique words in the text
-        def tryencode(str):
-            if not isinstance(str, unicode):
-                str = str.encode("utf-8", "replace")
-            return str
-        text = tryencode(text).upper()
+        if not isinstance(text, unicode):
+            text = unicode(text, "utf-8", "replace")
+        text = text.upper()
         wordlist = [w.encode("utf-8")
                     for w in re.findall(r'(?u)\b\w{%d,%d}\b'
                                         % (self.minlength, self.maxlength), text)]