[gdal-dev] OCI driver and setting the client encoding

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Wed Sep 19 04:00:16 PDT 2012


Hi,

I spent some nice hours trying to get the Finnish characters to appear right in
Oracle. Now it looks like I have found a working solution but I would like to
know if it is correct and reliable.

I am on Windows, Finnins-Finland and chcp shows me code 850. Our Oracle is using
UTF-8 encoding.

I tried to transfer data from Spatialite (UTF-8) into Oracle but non-ASCII
characters were not transferred right. I converted data from Spatialite into GML
and tried what happens with native UTF-8. Not good so I converted GML into
ISO-8859-1 with iconv. Bad luck even this way. Then I converted data into
shapefiles and had some trials with setting the SHAPE_ENCODING environment and
still the characters were wrong in Oracle side.

I continued and read a few documents about Oracle NLS_LANG settings and tried to
set NLS_LANG to correspond with what I thought to suit my console settings. This
made difference; I got still wrong results but they were different and I started
to believe that I may be able to win the beast.

Finally I set environment as
SET NLS_LANG=american.america.UTF8

Now I seem to get right characters into Oracle from Spatialite, GML, and
shapefiles.

Is this the right thing to do? If yes, will it work also for other locales and
could it thus be worth mentioning in the OCI documentation
http://www.gdal.org/ogr/drv_oci.html? Could it even be initialized automatically
by the OCI driver?

-Jukka Rahkonen-





More information about the gdal-dev mailing list