OK, so I have a simple object:
class PrimaryDef(SQLObject):
     _connection=sqlobject.connectionForURI("mysql:// 
infoshopkee...@localhost/lexiko? 
use_unicode=1&charset=utf8&sqlobject_encoding=utf-8")
     class sqlmeta:
         fromDatabase=True
If I try to add an ascii record, it works.
If I try to add a unicode record
        PrimaryDef(lemma=u"λήμμα῾῾)
                or even
        PrimaryDef(lemma=u"λήμμα῾῾).encode("utf-8")
I get the standard
/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
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])))
     386
     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
        PrimaryDef._connection.sqlrepr(u"λήμμα῾῾)
it gives me
        "'\xce\xbb\xce\xae\xce\xbc\xce\xbc\xce\xb1'"

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.
--Marko


------------------------------------------------------------------------------
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to