Hello

I use SQLObject 0.9.0 with TurboGears, and I experience problems when I 
try to add binary data to a BLOBCol. The database (MySQL 5.0.33) is set 
up to use utf-8.

When I try to add binary data to the BLOBCol SQLObject tries to decode 
the data as utf8:


[...]
     m.image = image
   File "<string>", line 1, in <lambda>
   File 
"c:\python24\lib\site-packages\SQLObject-0.9.0-py2.4.egg\sqlobject\main.py", 
line 1061, in _SO_setValue
     self._connection._SO_update(
   File 
"c:\python24\lib\site-packages\SQLObject-0.9.0-py2.4.egg\sqlobject\dbconnection.py",
 
line 642, in _SO_update
     self.query("UPDATE %s SET %s WHERE %s = (%s)" %
   File 
"c:\python24\lib\site-packages\SQLObject-0.9.0-py2.4.egg\sqlobject\dbconnection.py",
 
line 836, in query
     return self._dbConnection._query(self._connection, s)
   File 
"c:\python24\lib\site-packages\SQLObject-0.9.0-py2.4.egg\sqlobject\dbconnection.py",
 
line 339, in _query
     self._executeRetry(conn, conn.cursor(), s)
   File 
"c:\python24\lib\site-packages\SQLObject-0.9.0-py2.4.egg\sqlobject\mysql\mysqlconnection.py",
 
line 113, in _executeRetry
     query = unicode(query, self.encoding)
   File "C:\Python24\lib\encodings\utf_8.py", line 16, in decode
     return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 35: 
unexpected code byte


Is this correct behaviour? I would think binary data should go straight 
in and out of the database, regardless of charset.


Regards,

Tom

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to