encoding issue

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Annavelle
Posts: 5
Joined: Fri 22 Jun 2012 02:56

encoding issue

Post by Annavelle » Fri 02 Aug 2019 04:13

Hi, we have some encoding issue .

server; Oracle 8i Windows(CHARSET:JA16SJIS)
clinet: Windows 10/dotConnect oracle 9.7.805(evaluting/Direct mode)/C#

There are some CHAR(n) columns contains Multi-byte(Shift-JIS) characters.
Almost characters can converted valid Unicode, but 'platform dependent' characters
like '\x878a' shown as 'u+fffd'(shuld 'u+3231').

Also, query contains platform dependent characters doesn't work right.

How to solve this problem?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: encoding issue

Post by Shalex » Fri 02 Aug 2019 18:07

Confirm that the issue persists with the "Unicode=true;" connection string parameter as well.

1. Execute "SELECT * FROM NLS_DATABASE_PARAMETERS" against Oracle 8i and specify your values:
a) NLS_CHARACTERSET
b) NLS_NCHAR_CHARACTERSET
c) NLS_LANGUAGE
d) NLS_RDBMS_VERSION

2. Navigate to Control Panel > Region and tell us regional settings of your Windows 10 where you are using dotConnect for Oracle:
a) the Format drop-down value
b) Location
c) Language for non-Unicode programs

3. Are you using .NET Framework Devart.* assemblies (shipped with provider installation) or .NET Standard Devart.* assemblies (available via https://www.nuget.org/packages/devart.data.oracle)?

4. Describe your test application:
a) are you reading character via OracleDataReader.GetChar() or some other way?
b) did you change a default encoding of your application? Refer to https://docs.microsoft.com/en-us/dotnet ... mework-4.8
c) can you read the character 'u+3231' via our provider if you convert it to AL32UTF8 on Oracle side via "select CONVERT(fieldname, 'AL32UTF8', 'JA16SJIS') from tabllename;"?

5. A small test project with the corresponding DDL/DML script for reproducing will be appreciated. Upload it to some file exchange server (e.g.: www.dropbox.com) and send us the download link.

Annavelle
Posts: 5
Joined: Fri 22 Jun 2012 02:56

Re: encoding issue

Post by Annavelle » Mon 05 Aug 2019 00:58

1)
SQL> SELECT * from NLS_DATABASE_PARAMETERS ;

PARAMETER VALUE
------------------------------ --------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-YY
NLS_DATE_LANGUAGE AMERICAN
NLS_CHARACTERSET JA16SJIS
NLS_SORT BINARY
NLS_NCHAR_CHARACTERSET JA16SJIS
NLS_RDBMS_VERSION 8.0.4.0.0

2)
a)Match Windows display language
b)Japan
c)Japanese
Written in Japanese.

3)
I've executed downloaded installer from devart.com,
and installed 'Devart.Data.Oracle' package from Nuget for project.

4)
a)I tried OracleDataReade.GetChars() and OracleDataReade.GetString().
b)Not registerd. Oh, targetd framework is '.NET Framework 4.6.1'.
c)ORA-01482:unsupportde character set :-/


5)
--------------------- sample code -----------------------
OracleConnectionStringBuilder csb = new OracleConnectionStringBuilder();
csb.Direct = true;
// csb.Server = "***.***.***.***";
csb.Server = "***.***.***.***";
csb.Port = 1521;
csb.Sid = "orcl";
csb.UserId = "***";
csb.Password = "***";
csb.Unicode = true;
OracleConnection conn = new OracleConnection(csb.ConnectionString);
conn.Open();

string sql = "select some_field from some_table";
var command = conn.CreateCommand(sql);
var reader = command.ExecuteReader();
reader.Read();
var value = reader.GetString(0);
---------------------------------------------------------



---------------- also, this works right :-) -------------
string sql = "select DUMP(some_field) from some_table ";
var command = conn.CreateCommand(sql);
var reader = command.ExecuteReader();
reader.Read();
var value = reader.GetString(0);
// parse binary
var n = value.SkipWhile(t => t != ':').Skip(1)
.Aggregate("",(a,c)=>a+=c)
.Split(',').Select( t=>byte.Parse(t)).ToArray();
var str = Encoding.GetEncoding("Shift_JIS").GetString(n);
---------------------------------------------------------

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: encoding issue

Post by Shalex » Fri 09 Aug 2019 18:19

Thank you for the test project provided by email. We will investigate it and notify you about the result.

Post Reply