Hello Group!

I am having some character-set problems with SQLObject and MySQLdb
within a turbogears project.

my dsn:
sqlobject.dburi="notrans_mysql://user:[EMAIL 
PROTECTED]/database?charset=utf8&debug=True"

my class:
class aTest(SQLObject):
class sqlmeta:
table="atest_test"

name=UnicodeCol(length=100)

in the shell:
>>> aTest(name="abc")

<aTest 1L name=u'abc'>

#this one was alright BUT:

>>> meinTest(name="äöü") # causes:

Traceback (most recent call last):
(...)
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/
sqlobject/main.py", line 1111, in set
value = to_python(dbValue, self._SO_validatorState)
File "/usr/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/
sqlobject/col.py", line 549, in to_python
return unicode(value, self.db_encoding)
File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-2:
invalid data

If i change dsn and append "?charset=utf8" and
>>> meinTest(name="äöü")
error traceback changes to:
(...)
File 
"/usr/lib/python2.4/site-packages/SQLObject-0.8.0-py2.4.egg/sqlobject/col.py",
line 549, in to_python
return unicode(value, self.db_encoding)
File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 4-6:
unexpected end of data

The Database, the table and the corresponding field "name" in the
table have the collation "utf8_unicode_ci", charset "utf8"

What can i do to solve this problem?

Regards, Frank
-------------------------------------------------------------------------
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