From: Glenn M. <gle...@gm...> - 2008-01-07 15:09:56
|
Oleg, 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? Thanks Glenn On Jan 4, 2008 5:32 PM, Oleg Broytmann <ph...@ph...> 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. > -- > Oleg Broytmann http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > |