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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

hidura
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.

--
http://mail.python.org/mailman/listinfo/python-list