The following results in correct data going into and coming out of the database, but the data in the database itself looks double encoded:
import MySQLdb connection = MySQLdb.connect(host="fmapp03", user="foxmarks", passwd='ChunkyBacon', db="users") cursor = connection.cursor() cursor.execute(""" INSERT INTO users VALUES (12345678, 'jjtest1234', '[EMAIL PROTECTED]', 'pass', %s, 'asdf', 'N/A', 'N/A', 0, NOW(), NOW()) """, ('\xc3\xa7',)) cursor.execute("SELECT * FROM users WHERE id = 12345678") row = cursor.fetchone() print `row` connection.commit() The following results in correct data going into and out of the database, but does not result in the data in the database itself being double encoded: import MySQLdb connection = MySQLdb.connect(host="fmapp03", user="foxmarks", passwd='ChunkyBacon', db="users", charset='utf8') cursor = connection.cursor() cursor.execute(""" INSERT INTO users VALUES (12345678, 'jjtest1234', '[EMAIL PROTECTED]', 'pass', %s, 'asdf', 'N/A', 'N/A', 0, NOW(), NOW()) """, (u'\xe7',)) cursor.execute("SELECT * FROM users WHERE id = 12345678") row = cursor.fetchone() print `row` connection.commit() It looks like for the version of MySQLdb I'm using, 1.2.1p2, a lot of this stuff has changed. If you don't let MySQLdb take care of encoding and decoding, it ends up double encoding things in the database. This must be a bug in MySQLdb. The clear way to work around the bug is to let the driver take care of encoding and decoding instead of SQLAlchemy. Yuck, -jj --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---