Hi
I thought I had resolved my unicode problems but there is still a bug
related to mysqldb.
I connect sqlobject 0.7.1 with ?use_unicode=1&sqlobject_encoding=utf8

when I put french accents in an unicode string and store it to sqlobject
unicode col, it works.
On my website also, pages are in utf8.
However, I got an error message like this:

File 
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/main.py",
 line 1143, in set [edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/main.py&line=1143>
    self._connection._SO_update(self, args)
  File 
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py",
 line 567, in _SO_update [edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py&line=567>
    self.query("UPDATE %s SET %s WHERE %s = (%s)" %
  File 
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py",
 line 307, in query [edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py&line=307>
    return self._runWithConnection(self._query, s)
  File 
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py",
 line 221, in _runWithConnection [edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py&line=221>
    val = meth(conn, *args)
  File 
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py",
 line 304, in _query [edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/dbconnection.py&line=304>
    self._executeRetry(conn, conn.cursor(), s)
  File 
"/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/mysql/mysqlconnection.py",
 line 74, in _executeRetry [edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1926-py2.4.egg/sqlobject/mysql/mysqlconnection.py&line=74>
    return cursor.execute(myquery)
  File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line 149, in execute 
[edit] 
<https://secure.worldspot.net/wk/Admin/EditFile?filename=/var/lib/webkit/prod/build/bdist.linux-i686/egg/MySQLdb/cursors.py&line=149>
UnicodeEncodeError: 'latin-1' codec can't encode character u'\ufffd' in 
position 722: ordinal not in range(256)


I could reproduce it on the command line and did a traceback.
I can see sqlobject making the _query with a simple string that is utf8
encoded (I can encode it back to utf8 unicode string and can see the 
u'\ufffd' character displayed.)
I can't see why mysqldb reencode the string into latin-1 which does not
support this character.
Unfortunately I don't have mysqldb source to investigate farther.

If someone has a workaround, I'd be strongly interested.

NOTE: I still have the mysql5 server gone message with the new mysqldb
1.2.2 (unpatched)


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to