Search code examples
.netoracleoracleclient

Oracle Connection and nls_lang


I have a legacy database set with NLS_LANG set to IW8ISO8859P8. This I cannot change.

I have another application, that is not working with unicode, that works on the same data my application works on. In some of the fields, and some of the times, the user inserts as part of a string, the character 161 which represents NIS currency simble. When I try to read this data from .Net using oledb, all is well but when I try to do so with the oracle client, I get garbage data instead. also when I insert in .Net the NIS simble, it is saved as garbage.

I know I can manipulate the data after I got it, but I am looking for some configuration of the oracle client in .Net to get this to work.

I have been working on this for a few weeks now, any help would be appriciated. Tnx Noam


Solution

  • At the end of the day I solved it using a secondary nvarchar column. and triggers to translate between them.

    I have written functions in plsql that do a byte conversion to and from Unicode, using a custom encoding realized by many many if statements.

    And for each column with the problematic data I added a second column with nvarchar storage, and triggers that uses that function to translate the problematic data.

    So the legacy applications uses and updates the varchar columns, and the triggers translate it to the Unicode columns. and the .Net code uses the Unicode columns, and again the triggers translate the info to the problematic encoding used in the legacy application.

    If you need more info, please feel free to contact me for more information