From: Glenn M. <gle...@gm...> - 2008-01-07 16:43:28
|
I do get the schema using fromDatabase. This is a simple table with 2 columns: id, int and label, varchar(64). Everything until now has been ascii, but I now have one string, Ch=E8rie, which I read from a file that I need to add to the db using SQLObject. If I do the insert from the command line into the db locally it works fine, so I think MySQL is setup correctly to handle this. It looks like somewhere in SQLObject we are calling decode on the variable which contains Ch=E8rie to decode it to ascii. Is this the intended result? I have tried to manually define the column in the class definition, label =3D UnicodeCol() This did not change anything, I get the same error. The last line in the traceback comes from dbconnection.py line 383. This calls self.sqlrepr whic= h must be the source of the problem. I have tracked it down to the return statement of the StringLikeConverter, line 96 on converters.py. return "'%s'" % value seems to be doing a decode (or encode) which is failing. Note in the debugger I see the type of the param value in that function is str, I would think it would be unicode. Any help would be great! Glenn On Jan 7, 2008 10:38 AM, Oleg Broytmann <ph...@ph...> wrote: > On Mon, Jan 07, 2008 at 10:09:51AM -0500, Glenn MacGregor wrote: > > ?charset=3Dutf8&use_unicode=3D1 > > Do you draw the database scheme from the DB using fromDatabase? > > > I am reading data from a file, one piece of data contains a char outsid= e > of > > the ascii range (0xc3). I need to insert that into the db, the column > type > > is a varchar(64) > > First question to decide is: what is the type of the data? Is it string= , > unicode or binary data? For strings, use StringCol, but do not put unicod= e > to the column - convert it to a string yourself. For unicode use > UnicodeCol, and put unicode to the column. For binary data use BLOBCol or > StringCol; then again, use strings as the data input. > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > |