[Mono-devel-list] System.Data.OracleClient

Jörg Rosenkranz joergr at voelcker.com
Fri May 7 04:05:38 EDT 2004


Hello Eduard,

-----Original Message-----
From: Eduard Nesiba [mailto:eduard.nesiba at monetplus.cz] 
Sent: Thursday, May 06, 2004 9:08 PM
To: Jörg Rosenkranz
Subject: Re: [Mono-devel-list] System.Data.OracleClient




Does System.Data.OracleClient under MS.NET behave the same way?

  

Yes, it does. 

Then this would be OK to commit. Otherwise we would break compatibility between MS.NET and Mono.    

- statement char set conversion

    



Please do not convert back to Encoding.Default. The encoding 

Oracle uses is defined by the environment variable NLS_LANG.

Encoding.Default requires this variable to be set to the right encoding

for the current system. Using the current implementation you 

simply set

	

	NLS_LANG=AMERICAN_AMERICA.UTF8



and character conversion works regardless of the encoding the

local system uses. If we want a really clean implementation we have

to choose the encoding for statements and results according to NLS_LANG.



  

OK. But if we want output/input in other code page (we are using ISO8859-2) we must do this char set conversion.
Tested on Linux a Windows and everything fine according NLS_LANG settings.

 

We are using ISO-8859-1 on our systems to handle german umlauts. This works fine because UTF8
is only used as encoding between Oracle and the client. Using DefaultEncoding the setting of 
NLS_LANG depends on the local encoding settings. It has to be set to EE8ISO8859P2  on your 
systems and  WE8ISO8859P1 on our systems to allow non ASCII characters. Using the current
implementation it can always be set to UTF8 regardless of the character set the OS uses.
 
The best way to handle this would be to check NLS_LANG and use the configured encoding
in System.Data.OracleClient. I don't know if there is an easy way to do the mapping of Oracle
character set names to Mono encodings other than a big mapping table.  Maybe something like:
 
string enc;
 
switch ( oracleEncoding ) {
    case "WE8ISO8859P1":    enc = "iso-8859-1"; break;
    case "EE8ISO8859P2":    enc = "iso-8859-2"; break;
    ...
    default: enc = "utf-8"; break;    // UTF8 as fallback
}
 
Encoding oracleEncoding = Encoding.GetEncoding(enc);
 
You can find the Oracle char set names in the "Database Globalization Support Guide".
 
Joerg.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040507/caa53fde/attachment.html 


More information about the Mono-devel-list mailing list