Hello,

[Sorry for posting it here while it's clearly not an TG problem]

I have created a data model class with the UnicodeCol column.

When trying to use it I got the error:

Traceback (most recent call last):
  File " booklist.py", line 11, in ?
    BookEntry(pubid='sample1xxxxx', ISBN='',
author=u'╨С╤А╨░╤В╤М╤П')
  File
"C:\Python24\Lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\main.py",
line 1183, in __init__
    self._create(id, **kw)
  File
"C:\Python24\Lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\main.py",
line 1210, in _create
    self._SO_finishCreate(id)
  File
"C:\Python24\Lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\main.py",
line 1237, in _SO_finishCreate
    self._init(id)
  File
"C:\Python24\Lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\main.py",
line 947, in _init
    self._SO_selectInit(selectResults)
  File
"C:\Python24\Lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\main.py",
line 1135, in _SO_selectInit
    colValue = col.to_python(colValue, self._SO_validatorState)
  File
"C:\Python24\Lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\col.py",
line 517, in to_python
    return unicode(value, self.db_encoding)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 10-11:
invalid data

I'm using MySQL 4.1 and SQLObject 0.7. Database was init'ed with
character set utf-8 and so is the data.

AFAICT, it's been inserted already mangled and so an error on read is
expected. IMO, "set names utf8" is missing.

Reply via email to