It's amazing that every fucking release they change how to handle unicode...! I have had a lot of trouble with this.
Basically here what to do: BANG your head against the wall :) On a side note: Getting unicode to work with MySQLdb depends on the version (and in MySQLdb case, EVERY version counts, because there is no consistency in their unicode specification). Anyway, here how I tell MySQLdb to use unicode. I "think" it works with most MySQLdb versions... [from http://orangoo.com/skeletonz_dev/browser/trunk/amilib/amiweb/amidb.py]: def _connect(self): try: self.con = MySQLdb.connect(db=db, user=user, passwd=password, host=host, use_unicode=True) self.con.charset = "utf8" except MySQLdb.OperationalError, e: print "\nCould not connent to MySQL. Following error encountered:" print e except: self.con = MySQLdb.connect(db=db, user=user, passwd=password, host=host, unicode="utf8") def query(self, sql): self._createCursor() #Run the query if type(sql) == types.StringType: sql = unicode(sql, "utf8") if MySQLdb.__version__ != "1.2.1_p2": sql = sql.encode("utf8") try: rc = self.cursor.execute(sql) result = self.cursor.fetchall() last_id = self.cursor.lastrowid finally: self._closeCursor() if sql.find("INSERT ") == 0: return last_id else: return result 4mir --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~---

