I am maintaining a legacy oracle proc C/C++
code which is processing a text file and updates the DB. In the code they are preparing a SELECT
statement which looks something like this
SELECT 'ERROR_ID=§' || ERROR_ID || '§' || ' AND ' ...
and after executing the select statement, they are getting the data as shown below in a char array.
ERROR_ID=§ASI:10§ AND
later they are replacing the sectional symbol(§) with single quotes as shown below
if((char)file_str.arr[k]=='§')
{
strncpy((char*)&file_str.arr[k],"'",1);
}
Basically they are getting the primary keys from the DB (old primary key)and and comparing the primary key which are present in the text file (new keys).
They are using simple strcmp
to compare the these primary keys.
Now I am getting an issue. Even though old and new the primary keys are matching, if I look at the log file, these question marks are coming instead of single quotes.
ERROR_ID=?ASI:10? AND FORM_ID=?064956? - old key
ERROR_ID='ASI:10' AND FORM_ID='064956' - new key
I am guessing that, since they are using the sectional symbol(§)
in the code which is a non ASCII char
, it is failing.
Please suggest.
Update: The same binary is deployed in different environments. On some of the environments, sectional symbol(§) the is getting replaced with '?' marks, and on some it is working fine. Question: Are there any environment setting that is affecting this? If yes, what I should look for.
OS on all the environments is: SunOS 5.10