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èrie,
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èrie to decode it to ascii. Is this the intended result?

I have tried to manually define the column in the class definition,

label = 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 which
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 <[EMAIL PROTECTED]> wrote:

> On Mon, Jan 07, 2008 at 10:09:51AM -0500, Glenn MacGregor wrote:
> > ?charset=utf8&use_unicode=1
>
>   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 outside
> 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 unicode
> 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/            [EMAIL PROTECTED]
>           Programmers don't die, they just GOSUB without RETURN.
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to