Hi there. I have a small system in production with wxPython and PostgreSQL running on a machine with Centos 5. At first everytihing was running ok but now a weird bug was discovered: they can't insert characters like á é í ó ú ä ë ñ .... (non english characters) Does anyone knows how can I make pgdb accept that kind of characters? I wrote a little script...
But first CREATE DATABASE test; CREATE TABLE tabla( cad character varying ) ; #!/usr/bin/python # -*- coding: utf8 -*- import pgdb con = pgdb.connect(user="farfan", password='000000', host='localhost', database='test') cur = con.cursor() cur.execute("INSERT INTO tabla VALUES ('é')") con.commit() cur.execute(u"INSERT INTO tabla VALUES ('é')") con.commit() and this is the result python Aplicacion.py Traceback (most recent call last): File "Aplicacion.py", line 10, in ? cur.execute(u"INSERT INTO tabla VALUES ('é')") File "/usr/lib/python2.4/site-packages/pgdb.py", line 175, in execute self.executemany(operation, (params,)) File "/usr/lib/python2.4/site-packages/pgdb.py", line 198, in executemany raise OperationalError, "internal error in '%s': %s" % (sql,err) [EMAIL PROTECTED] ~]$ python Aplicacion.py Traceback (most recent call last): File "Aplicacion.py", line 8, in ? cur.execute(u"INSERT INTO tabla VALUES ('é')") File "/usr/lib/python2.4/site-packages/pgdb.py", line 175, in execute self.executemany(operation, (params,)) File "/usr/lib/python2.4/site-packages/pgdb.py", line 198, in executemany raise OperationalError, "internal error in '%s': %s" % (sql,err) pg.OperationalError As you can see, the first insert statement is executed in ascii format and is succeful, the second, which is in Unicode, fails the problem is thas wxPython will allways send the script in unicode format... any ideas on how to fix it? rb3m dijo: Un buen programador no es uno que se sepa un lenguaje al derecho y al revés, sino el que sabe resolver un problema y después implementar la solución en el lenguaje más adecuado. _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor