Hi, I am using SQLObject-0.8dev_r1814, MySQLdb 1.2.1_p2 and MySQL 5.0.22 on Arch Linux. I am using fields of type UnicodeCol. When I try to insert such object to the database I get an exception which originates in MySQLdb:
File "/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1814-py2.4.egg/sqlobject/mysql/mysqlconnection.py", line 66, in _executeRetry return cursor.execute(query) File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 146, in execute query = query.encode(charset) UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 196: ordinal not in range(128) I tried to pass the data both as unicode strings and as normal strings with utf8 encoding. It seems like SQLObject is sending the query to MySQLdb as a normal string, encoded in utf8. But, MySQLdb excepts it to be a unicode string, because lines 145-156 in cursors.py are: charset = db.character_set_name() query = query.encode(charset) Also, it turns out that the value of charset is 'latin1'. I am not sure why it is so, but I could force it to be 'utf8' if I changed the connect() call in makeConnection() method of mysqlconnection.py to have a keyword argument charset='utf8'. Of course it does not help, since SQLObject already sends an encoded string. Any Ideas? Thanks, Nadav Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss