Just assumed using the sqlmeta fromDatabase=True formatted columns right (they are typed as utf-8 in the database).
Why doesn't this work, I wonder? Should I file it as a bug? UnicodeCol works, but the one column is going to be a mighty big text chunk sometimes..... Will sqlobject truncate ever?

On Jun 28, 2009, at 3:21 AM, Imri Goldberg wrote:

This might be a stupid question, but you didn't include the full source of PrimaryDef, so I have to ask.
How did you define the column? If you set a StringCol instead of a UnicodeCol, that might explain it.

Also, noe that your second example,
does the encoding only after trying to add to the table. Maybe you intended to write


On Sun, Jun 28, 2009 at 4:22 AM, Markos Kapes <mkapes@gmail.com> wrote:
OK, so I have a simple object:
class PrimaryDef(SQLObject):
    class sqlmeta:
If I try to add an ascii record, it works.
If I try to add a unicode record
               or even
I get the standard
python2.5/site-packages/sqlobject/dbconnection.pyc in _insertSQL(self,
table, names, values)
    383         return ("INSERT INTO %s (%s) VALUES (%s)" %
    384                 (table, ', '.join(names),
--> 385                  ', '.join([self.sqlrepr(v) for v in values])))
    387     def transaction(self):

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

So far so good, I'm still thinking that the connection isn't getting
my  option keys to know it's supposed to be unicode an then chokes at
sqlrepr, but if I just do
it gives me

What am I missing here? the table is utf8, the dbencoding is utf8, I'm
even on OS X, which is utf8.... what gives?
Thanks for any help.

sqlobject-discuss mailing list

Imri Goldberg
-- insert signature here ----