On May 18, 2009, at 6:17 PM, zugnush wrote:
> > Thanks, I'm still getting a unicode decode error though. > > C:\Python26\lib\site-packages\sqlalchemy-0.5.2-py2.6.egg\sqlalchemy > \types.pyc in process(value) > 468 def process(value): > 469 if value is not None and not isinstance(value, > unicode): > --> 470 return value.decode(dialect.encoding) > 471 else: > 472 return value > > C:\Python26\lib\encodings\utf_8.pyc in decode(input, errors) > 14 > 15 def decode(input, errors='strict'): > ---> 16 return codecs.utf_8_decode(input, errors, True) > 17 > 18 class IncrementalEncoder(codecs.IncrementalEncoder): > > UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position > 13: unexpected code byte > > > > If I'm following this correctly it's because I've told sqlalchemy to > convert to unicode and the problem is that the value stored in the > database is already unicode. So what I really needed to do is to tell > sqlalchemy that the stored values are *already* unicode. well, the DBAPI is not sending python unicode, or that error would not occur. so you need to have the client encoding set as well. Im assuming this is MySQL ? check the DatabaseNotes page on the wiki which illustrates the best flags to send to create_engine(). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
