lokki schrieb:
> 
> [...] i decided to switch the MySQL4.1 db that runs on the
> production server. Before trying to do anything on the server i
> created a schema on the MySQL 5 database that i have at home to start
> testing. On my first attempt to add a file on the db from a form of
> the site i got :
> 
> [...]
>   File "/home/lokki/TurboGears/Yfanet/yfanet/subcontrollers/
> controlpanel.py", line 450, in savephoto
>     p =
> Photo(p_title=kwargs['photo_title'],p_descr=kwargs['photo_descr'],p_photo=image)
>   [...]
>   File "/usr/lib/python2.4/site-packages/SQLObject-0.7.3-py2.4.egg/
> sqlobject/mysql/mysqlconnection.py", line 98, in _queryInsertID
>     self._executeRetry(conn, c, q)
>   File "/usr/lib/python2.4/site-packages/SQLObject-0.7.3-py2.4.egg/
> sqlobject/mysql/mysqlconnection.py", line 77, in _executeRetry
>     myquery = unicode(query, self.encoding)
>   File "encodings/utf_8.py", line 16, in decode
> UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position
> 94: unexpected code byte
> [...]

I don't know where the bugreport is, but you can avoid lots of issues
that way:

1. Upgrade to MySQLdb-1.2.2
   ('cause there is another unicode-issue in 1.2.1)
2. let MySQL always use UTF-8/unicode
   (if you cannot change defaults on your MySQL you can try the
    corresponding connection parameters; some of
    charset=utf8&sqlobject_encoding=utf-8&use_unicode=1)
3. easy_install SQLObject==bugfix
   (Will pull SQLObject 0.7.5 from SVN. You won't get happy with
    SQLObject 0.8, so if you don't like 0.7 go ahead to 0.10)
4. in "sqlobject/mysql/mysqlconnection" remove lines 31-34 (including)
   to let SQLObject have your querries pass directly to MySQLdb as
   they are delivered - in Unicode

I run a rather complex application with characters from several
alphabets without any MySQL-related issues anymore. Give it a try.

If someone knows a better solution to point 4, let me know please.

-- Mark

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to