Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: LANG and NLS_LANG for UTF8
dbaplusplus_at_hotmail.com wrote:
> My database is on UNIX server and when I do export/import, I will of
> course have to set NLS_ LANG,
> otherwise it defaults to ASCII and export gives warning message that
> export is being done in ASCII whereas database is in UTF8.
>
> I can see if I insert data directly from Windows then I have to worry
> about NLS_LANG setting on PC and WE8MSWIN1252
>
> Since I am on UNIX I am trying to figure where LANG value is required.
> As for as I know Oracle uses NLS_LANG for all
> its processing but If I am writing Java, C or C++ code to access
> database, I should also be setting LANG,
I believe that I understand your problem now.
You actually habe 2 problems.
First, the LANG environment variable should not have an influence on Oracle, as the character set is determined by NLS_LANG.
You are right that if you want to view or manipulate data thus generated by Oracle, you will have to have your locale (LANG environment variable) set appropriately (if you 'cat' an UTF-8 file and your locale is C, all but the characters < 128 will look like garbage).
To quote the documentation:
Datafile Character Sets
By default, the datafile is in the character set defined by the NLS_LANG parameter. The datafile character sets supported with NLS_LANG are the same as those supported as database character sets. SQL*Loader supports all Oracle-supported character sets in the datafile (even those not supported as database character sets).
The character set of the datafile can be set up by using the NLS_LANG parameter or by specifying a SQL*Loader CHARACTERSET parameter.
Your second problem:
> Despite both setting, have not been able to insert non ASCII utf8
> characters using sqlloader. I inserted some non ASCII chacaters such
> Ö in a file on my PC, but when I copy and paste this to UNIX (even
> when LANG=C.utf8, somehow these charactres disappear).
Please verify that the data that you 'copied and pasted' into the UNIX arrived there in the correct encoding.
Yours,
Laurenz Albe
Received on Fri Feb 17 2006 - 02:33:44 CST