I have been fooling around with this all weekend and I am still unsure of what is going on.  In the connections string I now use ?charset=utf8&use_unicode=1, this seems to get past the original error, now I am getting caught elsewhere.

When I try to add the offending string to the db I get:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 20: ordinal not in range(128)

I may be totally off here, so I want to let you know what I am trying to do.

I am reading data from a file, one piece of data contains a char outside of the ascii range (0xc3). I need to insert that into the db, the column type is a varchar(64). I am not sure where to start, I believe the db (MySQL) is setup correctly using unicode. I am new to python and SQLObject so I an unsure of the unicode support in both.

Is there a tutorial or something that can help me work this out?



On Jan 4, 2008 5:32 PM, Oleg Broytmann <phd@phd.pp.ru > wrote:
On Fri, Jan 04, 2008 at 05:08:49PM -0500, Glenn MacGregor wrote:
>         if isinstance(value, unicode):
> -->            return value.encode("ascii")

  I guess you are trying to pass unicode to a StringCol. If this is the
case - for unicode use UnicodeCol.

    Oleg Broytmann            http://phd.pp.ru/            phd@phd.pp.ru
          Programmers don't die, they just GOSUB without RETURN.