[Zope-DB] DCOracle2 Unicode Question

Dominic Hiles Dominic.Hiles at bristol.ac.uk
Mon Apr 26 06:17:33 EDT 2004


Dear Oliver,

--On 26 April 2004 05:59 -0400 Oliver Jaun <Oliver.Jaun at ascom.ch> wrote:

> Hello
>
> I'm trying to execute a db-query with python. Some parameters are python
> unicode strings.
> I'm using python 2.1.3 and DCOracle2-1.2 with Oracle 9i (9.2) on Solaris
> 8. I get the following message:
>
> ValueError: invalid data type bound
>
> The database uses UTF-8.
> In the DCOracle2 documentation I found nothing about unicode. So the
> question is if there is a solution. I think one solution would be to
> encode the unicode string to something like 'bla\0A24gugus' and insert
> with " INSERT ... UNISTR(:1) ". However I would be much nicer if unicode
> support was transparent...
>
> Any suggestions?
>

I am not very experienced with this, but I've found that adding the 
following to the environment seems to work (providing the DB is configured 
for Unicode support to start with) with Oracle 8i - I'm not sure whether it 
is still relevant to Oracle 9i:

## Setup UTF8 variables
$ENV{NLS_LANG} = "ENGLISH_UNITED KINGDOM.UTF8";
$ENV{NLS_CHAR} = "UTF8";
$ENV{ORA_NLS} = "/path/to/oracle/ocommon/nls/admin/data";
$ENV{ORA_NLS32} = "/path/to/oracle//ocommon/nls/admin/data";

HTH,

Dominic



More information about the Zope-DB mailing list