[Pypgsql-users] Re: [ANN] pyPgSQL 2.1 released
Gerhard =?unknown-8bit?Q?H=E4ring?=
gerhard at bigfoot.de
Wed Jun 5 14:04:46 EDT 2002
* Gerhard Häring <gerhard.haering at gmx.de> [2002-06-05 19:55 +0200]:
> >>> from pyPgSQL import PgSQL
> >>> conn = PgSQL.connect(client_encoding="utf-8", unicode_results=1)
> >>> cursor = conn.cursor()
Here I missed something that (still) needs to be done explicitely:
cursor.execute("set client_encoding to UNICODE")
> >>> cursor.execute("insert into test(name) values (%s)", unicode("Österreich", "latin1"))
> >>> cursor.execute("select * from test")
> >>> res = cursor.fetchone()
> >>> print repr(res.name)
> u'\xd6sterreich'
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list