[cx-oracle-users] Unicode support
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2008-09-30 22:12:16
|
All, I just checked in to Subversion support for Unicode. Thanks go to Amaury Forgeot d'Arc for the patch he provided earlier this year and to everyone else for their patience. :-) Since I have little experience with languages other than English and I only have access to little endian machines I'd appreciate those of you with such experience or machines to test the new code for me and let me know the results. Note that now nchar, nvarchar2 data are now returned as unicode. It is also possible to bind unicode strings in to cursors. SQL statements and varchar2 and char data are still returned as encoded strings. Note that with another new feature in cx_Oracle you can force all strings to be returned as unicode if you so desire. Below is an example that will run with the data in the test suite: import cx_Oracle def OutputTypeHandler(cursor, name, defaultType, size, precision, scale): if defaultType in (cx_Oracle.STRING, cx_Oracle.FIXED_CHAR): return cursor.var(unicode, size, cursor.arraysize) connection = cx_Oracle.Connection("cx_Oracle/dev@eadev") connection.outputtypehandler = OutputTypeHandler cursor = connection.cursor() cursor.execute("select * from teststrings") for row in cursor: print "Row:", row If you have questions, let me know. If you have feedback, please provide it. Thanks. Anthony |