[Zope-DB] DCOracle2, Oracle, and NLS

Matthew T. Kromer matt@zope.com
Fri, 14 Feb 2003 11:34:44 -0500


Johnny Wezel wrote:

>I'm having trouble getting data with national characters (=E4=F6=FC etc)=
 into Oracle.
>
>While TOAD, the Oracle admin tool on Windows, displays data always right=
 (no
>matter whether I'm using VARCHAR2 or NVARCHAR2 or whatever), data from Z=
ope gets
>in the wrong way (=E4=F6=FC enters as dv|), no matter which data type I =
use. Also data
>entered with TOAD displays the wrong way (=E4=F6=FC shows as aou in Zope=
).
>
>Setting NLS_LANG (eg. AMERICAN_AMERICA.UTF8 or AMERICAN_AMERICA.WE8ISO88=
59P1) in
>the Zope start command has no effect, while with sqlplus it has the desi=
red
>effect.
>I suspect DCOracle2 does the trouble, or has somebody ever used it with =
national
>characters getting in and out of Oracle right?
>
>Cheers,
>Johnny Wezel
>
> =20
>


For what it's worth, DCOracle2 doesn't try setting anything with the=20
national language character sets.  What you MIGHT want to do is an ALTER=20
SESSION in your methods to set your language.  The most LIKELY thing is=20
that Oracle is trying to be "helpful" and is converting strings on you.=20
 The next most likely answer is that the python string conversion is not=20
doing something right, but a long as the encoding you want is a=20
single-byte code, you should be OK (since the buffers are all=20
single-byte character buffers, turned into string objects at the Python=20
layer.)