I have Linux + ORACLE 10.2
$ env | grep LAN
1 NLS_LANGUAGE AMERICAN
2 NLS_TERRITORY AMERICA
3 NLS_CHARACTERSET UTF8
4 NLS_NCHAR_CHARACTERSET AL16UTF16
I have a dynamic library and plsql function:
int sysrun(char command, char ying, char *yang)
FILE *fpointer ;
fpointer = fopen("out6.txt","wt");
printf( "!!! file error \n" );
fprintf(fpointer,"ying:%s yang:%s command:%s \n",ying,yang,command);
create or replace function sysrun_2 (syscomm in varchar2, ying IN VARCHAR2, yang IN VARCHAR2 )
as language C
parameters(syscomm string, ying string,yang string);
I send to library russian words(by sqlplus), but it write in a file bad symbols
I run query on sqlplus:
SELECT CONVERT('п╡я▀', VALUE) conv,VALUE FROM
where parameter = 'CHARACTERSET';
And see, that the best code page is CL8KOI8R
why CL8KOI8R? And where's from ?
And how can I change it ?
P.S. when I call library from Linux it's ok !!
You have to double-check your O/S configuration. The fact that you set LANG to UTF-8 does not mean that your terminal or terminal emulation (fonts, keyboards) actually works in UTF-8. You should verify both the settings used for SQL*Plus and the settings used by the editor/viewer that you use to verify the file contents.
To check the SQL*Plus configuration, first store the value in a column and use SQL function DUMP(column,1016) to look at the stored codes. If they are correct, e.g. in UTF-8, send the value to the library. Then, use
od -t x1 <file>
to look at the codes. If the codes are still UTF-8 codes, the problem is with your file viewer. If the codes are incorrect already in the column, your SQL*Plus session is not really working in UTF8 (input terminal issue).
I suspect either the input terminal or the file viewer work in KOI-8R.
the problem was with my viewer. When I open file by windows notepad it's ok.
But when I run Linux command $cat <file> I get bad characters too. WHY ?
And HOW can I setup Linux environment variables for correct view ?