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

Ivan Lucena ivan.lucena at princeton-ma.us
Thu Sep 20 07:30:09 PDT 2012


Hi Jukka,

>  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.

So, if I understood it, you are using ogr2ogr in a Finnins-Finland Windows locale but Oracle is set for american.america and the OGR/OCI driver doesn't make the distinction automatically.

Does your data has Finnins-Finland characters on it?

>  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?

Check that link for more information: 

http://www.oracle.com/technetwork/database/globalization/nls-lang-099431.html

Regards,

Ivan


More information about the gdal-dev mailing list