cx_Oracle and UTF8

Harald Armin Massa haraldarminmassa at gmail.com
Wed Feb 22 12:20:24 EST 2006


Hello,

I am looking for a method to convince cx_Oracle and oracle to encode
it's replies in UTF8.

For the moment I have to...

cn=cx_Oracle.connect("user","password", "database")
cs=cn.Cursor()

cs.execute("select column1, column2, column3 from table")

for row in cs.fetchall():
   t=[]
   for i in range(0,len(row)):
      if hasattr(row[i],"encode"):
        t.append(row[i].encode("utf8"))
      else:
        t.append(row[i])
    print t

Guess I am to much accustomed to postgresql which just allows "set
client_encoding='utf8'...

Harald




More information about the Python-list mailing list