How to conserve the integrity of the string from a database response using Python

Hidura hidura at gmail.com
Fri Feb 18 05:19:55 CET 2011


Hello, i am using py-postgresql as the driver the database, when make a
select to a string with non-ASCII characters, the response replace the
character with "�" what can i make to change this to the correct character?

This is my code:

<code>class decodify:

    def __init__(self):
        db = pgDriver.connect(user = 'demo', password='demo'
database='hidura_karinapp', host='localhost', port='5432')
        d = db.prepare("""SELECT modules_reg.code FROM modules_reg,
domain_reg, sbdomain_reg, sbdomdl_asc where(modules_reg.id =
sbdomdl_asc.module AND modules_reg.mdname = 'police' AND sbdomain_reg.id =
sbdomdl_asc.domain AND sbdomain_reg.domain = domain_reg.id AND
domain_reg.dname = 'bmsuite.com' AND sbdomain_reg.sbname = 'www')""")
        s = d()
        print(s)

if __name__ == '__main__':
    decodify()</code>

-- 
Diego I. Hidalgo D.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110218/89738991/attachment.html>


More information about the Python-list mailing list