On Feb 13, 2008, at 2:28 AM, [EMAIL PROTECTED] wrote:
> > Hello, I had a postgresql database: > CREATE DATABASE panizzolosas > WITH OWNER = postgres > ENCODING = 'UTF8'; > > and i'm using sqlalchemy 0.4.2p3. > this is my code > self.metadata=MetaData() > > engine = create_engine(stringaDATABASE, encoding='utf-8', > echo=False,convert_unicode=True) > > self.metadata.bind= engine > > try: > > table_ditta=Table('tblditta', self.metadata, autoload=True) > > mapper(Ditta, table_ditta) > > except : > > print "Error" > > > On the database I had some record with the caracter "à" and if I make > some updates I receive the error > > ProgrammingError: (ProgrammingError) invalid byte sequence for > encoding "UTF8": 0xe03537 > HINT: This error can also happen if the byte sequence does not match > the encoding expected by the server, which is controlled by > "client_encoding". > 'UPDATE tblditta SET codice=%(codice)s WHERE tblditta.id = % > (tblditta_id)s' {'tblditta_id': 592, 'codice': 'Cibra Publicit > \xe0577'} > > \xe0577 is à I suppose.. > would need to see the code youre using to insert data. Also, set "assert_unicode=True" on your create_engine() call; that will illustrate non unicode strings being passed into the dialect. When using convert_unicode=True at the engine level, *all* strings must be python unicode strings, i.e. u'somestring'. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---