Ernesto Revilla
2005-08-10 22:33:31 UTC
Hello.
When I query the database with the .execute method, and results have
international chars, I receive results with wrong international chars. (at
least I don't know the encoding.) Result are strings, not unicodes.
Could anyone give me some hints?
Here everything runs with UTF-8 (postgresql, shell, rekall, etc.) My code
is:
def eventFunc(ctrl, qrow, value):
# read default address
flds=("domicilio","poblacion","codigopostal","provincia")
blk=ctrl.__parent__.direccion
sql=u"select %s from personasdirecciones where personaid=%s AND orden=1"
cur=ctrl.cursor()
cur.execute(sql % (",".join(flds), value),[])
if cur.rowcount>0:
res=cur.fetchone()
for i,fld in enumerate(flds):
print cur.description()[i],"(",type(res[i]),"):",res[i]
getattr(blk,fld).value=res[i]
Best regards,
Erny
Spain
When I query the database with the .execute method, and results have
international chars, I receive results with wrong international chars. (at
least I don't know the encoding.) Result are strings, not unicodes.
Could anyone give me some hints?
Here everything runs with UTF-8 (postgresql, shell, rekall, etc.) My code
is:
def eventFunc(ctrl, qrow, value):
# read default address
flds=("domicilio","poblacion","codigopostal","provincia")
blk=ctrl.__parent__.direccion
sql=u"select %s from personasdirecciones where personaid=%s AND orden=1"
cur=ctrl.cursor()
cur.execute(sql % (",".join(flds), value),[])
if cur.rowcount>0:
res=cur.fetchone()
for i,fld in enumerate(flds):
print cur.description()[i],"(",type(res[i]),"):",res[i]
getattr(blk,fld).value=res[i]
Best regards,
Erny
Spain