5 Replies Latest reply on Jun 21, 2018 4:36 PM by Sergiusz Wolicki-Oracle

    pro * C character set issue

    naveenmani912

      Hi  Help me please

           I have issue around a Pro* C programmen which writes values from DATABASE into Flat file.

           when ever there are letters like    '    ¿çé£é    '  in the data base table . the Pro* C when writing to file using fprintf is converting to some other characters like  ¿  to ?  (or)  é tp e     etc.

          Kindly, help me understand why this character set conversion occurs.   Can you help me find out where the character encoding of Pro* C configuration lies please

         

       

      These are my database where the oracle table is present  configuration:

       

      select * from nls_database_parameters

      where parameter='NLS_CHARACTERSET';

      output: WE8ISO8859P15

       

      The NLS_LANG variable set inside the Pro* C programme.(I  checked for alter session command )

       

      however the command echo $nls_lang output is     AMERICAN_UNITED KINGDOM.WE8ISO8859P15

       

      My unix solaris  in which the Prod*C runs has the following locale command output

       

      LANG=

      LC_CTYPE="en_GB.ISO8859-15@euro"

      LC_NUMERIC="en_GB.ISO8859-15@euro"

      LC_TIME="en_GB.ISO8859-15@euro"

      LC_COLLATE="en_GB.ISO8859-15@euro"

      LC_MONETARY="en_GB.ISO8859-15@euro"

      LC_MESSAGES="en_GB.ISO8859-15@euro"

      LC_ALL=en_GB.ISO8859-15@euro

       

      Kindly help me out

        • 1. Re: pro * C character set issue
          Sergiusz Wolicki-Oracle

          What does the command

           

            env|fgrep NLS_LANG

           

          return just before you call the Pro*C program? Note, enter the command exactly as shown above.

           

           

          Thanks,

          Sergiusz

          • 2. Re: pro * C character set issue
            naveenmani912

            hi sergiuez

             

            i have put the the command exactly one line before the call of pro c progrmme

            NLS_LANG=AMERICAN_UNITED KINGDOM.WE8ISO8859P15

            • 3. Re: pro * C character set issue
              naveenmani912

              I am printing the oracle table content into flat file like

              below

               

                 EXEC SQL BEGIN DECLARE SECTION;

                  varchar sqlstmtnv[500];

                  varchar commandnv[2000];

                 EXEC SQL END DECLARE SECTION;

               

              FILE *fp_outputnv; 

              char out_filenv[200];

               

                    EXEC SQL PREPARE S FROM :sqlstmtnv;

                    EXEC SQL DECLARE C CURSOR FOR S;

                    EXEC SQL OPEN C;

                    fp_outputnv = fopen(out_filenv,"w");

                    EXEC SQL FETCH C INTO :commandnv;     /* i am skipping some looping or clarity */

                    fprintf(fp_outputnv, "%s\n", (char *)commandnv.arr);

              • 4. Re: pro * C character set issue
                naveenmani912

                hi sergiuez

                  My OS admin just replied back that he changed the NLS_LANG=AMERICAN_UNITED KINGDOM.WE8ISO8859P15 which didnt get reflected in CHARACTER CONVERSION till the restart of pro*C programme. which runs as daemon process .

                  This issue is now resolved.

                   Thank you for helping me out to find how to get a confirmation what NLS_LANG was set in production and what the proc*c programme would be used. much appreciated for the ASAP reply on my concern;

                • 5. Re: pro * C character set issue
                  Sergiusz Wolicki-Oracle

                  You are welcome.

                   

                  Please be aware that your NLS_LANG should match the expected character set of the produced files. If the files are to be displayed on Windows workstation, then the character set should be WE8MSWIN1252, as this is the character set that the Windows GUI expects. With WE8ISO8859P15, the Euro sign will be incorrectly displayed as the currency sign (¤).

                   

                  -- Sergiusz