From: Gerhard <ger...@gm...> - 2002-04-16 03:38:02
|
of 3 :) Cc-ing Adam, because he showed interest in this topic. I've resumed my work on integrating Unicode support into pyPgSQL, an updated patch can be found at: http://sourceforge.net/tracker/index.php?func=detail&aid=484468&group_id=16528&atid=316528 I'm pretty confident that this is approach will work out in the end, and the few tests that I've written and that are included in the patch work fine so far. *Especially* useful would be if those interested in Unicode/i18n support could try out this patch and comment on the interface. And I'd be really grateful if you could write additional testcases that exercise your native language and preferred client (and perhaps even server) encodings. I suggest to keep the discussion on the mailing list, if possible. A short example from the testcases to whet your appetite: text1 = unicode("Österreich-", "latin1") text2 = unicode("Ungarn", "ascii") conn = PgSQL.connect(host=host, database=dbname, client_encoding=("utf-8",), unicode_results=1) cursor = conn.cursor() cursor.execute("set client_encoding to unicode") cursor.execute(u""" CREATE FUNCTION concat_text (TEXT, TEXT) RETURNS TEXT AS ' BEGIN RETURN $1 || $2; END; 'LANGUAGE 'plpgsql'; """) cursor.callproc(u"concat_text", text1, text2) result = cursor.fetchone()[0] self.failUnless(result == text1 + text2, "procedure didn't return the two strings concatenated") Gerhard -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930 public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) |