On Apr 4, 2008, at 11:07 AM, mg wrote:
> > I have a postgres db that has content currently encoded as latin1. > When I try to query from the db I get the following error: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xa9 in position > 0: ordinal not in range(128) > > in my create_engine call I have encoding=latin parameter set. What am > I missing? > > I know that when I have worked with psycopg2 directly before i have > been able to use the set_client_encoding('latin1') and that has worked > fine. > well a basic thing is, SQLA interprets strings as plain bytestrings unless you use the Unicode datatype, or you set the "convert_unicode=True" on your engine to do it across the board. The "encoding" parameter doesn't get used otherwise. If you haven't done either of those, that's a place to start. I'm not sure if psycopg2 has the "client_encoding" parameter available at the connection level as a keyword argument to connect(). If it did, you could also set that up when you do create_engine() using the connect_args dictionary. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---