Page 1 of 2
Post Unicode in Delphi5, when UseUnicode=True & Direct=True
Posted: Tue 26 Oct 2010 11:48
by fandm
Hello.
I have a next problem.
I could not make
write (Post) UNICODE symbols in VARCHAR2 fields in DIRECT mode.
I'm using WinXP SP3 + Delphi 5 (with TNT Unicode VCL) +
ODAC 7.00.0.1 for Delphi 5 + Oracle 10g (10.2.0.1) + DB instance with charset AL32UTF8.
In the DB I have a table with a VARCHAR2 field. Script:
CREATE TABLE TEST
(
FIELD_VARCHAR2 VARCHAR2(4000 BYTE)
)
In Delphi 5
Session.Options.Direct = True,
Session.Options.Charset = '',
Session.Options.UseUnicode = True,
also I have an TOraTable connected to the table TEST and a TntDBGrid for visualization.
When I try to write something like "ŞşŢţĂă" ( Romanian special characters) in a TntDBGrid, I can see the word correct in TntDBGrid, but when I POST to DB, it loses the special diacritics in characters, so we will see "SsTtAa".
If I set Session.Options.Direct = False I can read and write unicode characters from/to the DB without any limitations.
Also I see correct unicode characters if I write (post) unicode symbols to VARCHAR2 field
not in Direct mode and then reconnect with Direct mode. But when I try to enter again the unicode characters (in Direct mode) - are the same problem.
I have previously addressed this problem
http://www.devart.com/forums/viewtopic. ... 2885#12885 (in 2006), but the problem was not solved. In this forum I found the similar topic
http://www.devart.com/forums/viewtopic.php?t=13647, but I don't know the problem is resolved.
As I have no problems when using ODAC through Oracle client I suppose there is a some problems in ODAC VCL in DIRECT mode. You wrote that this problem will be corrected (see link above), but I'm using
ODAC 7.00.0.1 and the problem is still there.
Please give me some direction how to use ODAC in DIRECT mode in my situation. Thanks.
Posted: Tue 26 Oct 2010 12:29
by AlexP
Hello,
Please check the NLS_LANG registry value, it should be ROMANIAN_ROMANIA.EE8MSWIN1250 for romanian characters, also try too set the TOraSession.Options.Charset property to EE8PC852.
If it doesn't help, try to set the OraCall.OCIUnicode property to true ( in this case you need to include the OraCall unit in the uses section).
Posted: Tue 26 Oct 2010 12:57
by fandm
Thanks for reply.
AlexP wrote:Hello,
Please check the NLS_LANG registry value, it should be ROMANIAN_ROMANIA.EE8MSWIN1250 for romanian characters, also try too set the TOraSession.Options.Charset property to EE8PC852.
Is NLS_LANG is related to the Direct mode? As I wrote,
the problem only occurs in Direct mode and only after post data. And your colleague on the forum wrote:
"When UseUnicode=True, Charset should be empty."
Ok. I tried it with UseUnicode=True and with UseUnicode=False, but this does not solve the problem. On the contrary, I can not even read the Unicode symbols in this case.
AlexP wrote:If it doesn't help, try to set the OraCall.OCIUnicode property to true ( in this case you need to include the OraCall unit in the uses section).
I'm using
Delphi 5. Is this true for this version? But Ok, I tried it also. But when I write OraCall.OCIUnicode := True in initialization section, I get an error message (EStackOverflow).
Some other solution?
Posted: Tue 26 Oct 2010 15:06
by AlexP
Hello,
Unfortunately, I can't test the problem on Delphi 5, because avaliable version TMS Unicode Component Pack exists only for Delphi 6.
I tested it in Delphi 7, and all data was saved to a database correctly, with your options.
The "Stack Overflow" bug was fixed, the fix will be included in the next build.
Posted: Wed 27 Oct 2010 06:21
by fandm
Hello,
Can I send you the TNT Unicode Controls for Delphi 5 and you'll spend test problem in Delphi 5?
And I'll spend test in Delphi 7.
Please.
Posted: Wed 27 Oct 2010 08:20
by fandm
Yes, indeed, under Delphi 7 all works correctly. However, under Delphi 5 - NO.
In what may be the reason? Maybe a bug in the module OraNet.dcu for Delphi 5?
Please, help solve the problem. I am willing to send you TNT Unicode Controls for Delphi 5.
Posted: Wed 27 Oct 2010 08:20
by AlexP
Hello,
First check the problem in Delphi 7, If it will work, please send me TNT Unicode Controls for Delphi 5 to alexp*devart*com.
Posted: Wed 27 Oct 2010 08:24
by fandm
Ok, sorry, we wrote messages at one moment.

Now I'll send you the Tnt Unicode Controls for Delphi 5. Thanks.
Posted: Wed 27 Oct 2010 08:35
by fandm
AlexP, I sent components for you.
Thanks.
Posted: Wed 27 Oct 2010 09:53
by AlexP
hello,
Thanks, I received your mail, but in Delphi 5 the data was correctly inserted to the table and I can see the correct characters in both modes.
Please try changing the TntDBGrid.Font.Charset property.
Posted: Wed 27 Oct 2010 10:25
by fandm
I've tried various values for TntDBGrid.Font.Charset property, but the problem still exists.
I think this property is not connected with the post of data in the database, because if you type unicode characters in direct mode when TntDBGrid.Font.Charset, for example, OEM_CHARSET or TURKISH_CHARSET or EASTEUROPE_CHARSET and then view the data in the table with, for example, Oracle SQL Developer, it is seen that the data saved as ANSI, not as Unicode.
If you enter Unicode characters are not in direct mode, similarly when TntDBGrid.Font.Charset = OEM_CHARSET or TURKISH_CHARSET or EASTEUROPE_CHARSET and then view the data in the table with Oracle SQL Developer, it is seen that the data saved correct, as Unicode.
Ok... Which build of Delphi 5, you used for test? My build is 5.62.
Posted: Wed 27 Oct 2010 11:25
by AlexP
hello,
My Delphi 5 build is 5.62.
I can see and write correct characters only when my advanced regional language options are set to Romanian, but in others cases the characters appear incorrectly in the grid.
Posted: Wed 27 Oct 2010 11:45
by fandm
So and what it's mean? In Delphi 7 all work correct in all regional language settings. So why not work in Delphi 5?
Posted: Wed 27 Oct 2010 14:06
by AlexP
Hello,
I can't tell anything until the problem is reproduced.
Please send me the project to demonstrate the problem (maybe we used different settings), the result of this query SELECT * FROM nls_database_parameters, and I'll try to reproduce the problem.
Posted: Wed 27 Oct 2010 14:29
by fandm
Just a moment... AlexP, but you wrote:
I can see and write correct characters only when my advanced regional language options are set to Romanian, but in others cases the characters appear incorrectly in the grid.
This means that you have reproduced the problem on other regional language settings, other than Romanian. Is not it? Or have I misunderstood you?
But ok. I'll send you my test project and screenshots regional language settings - it's Russian settings.
Result of query "SELECT * FROM nls_database_parameters":
NLS_LANGUAGE|AMERICAN
NLS_TERRITORY|AMERICA
NLS_CURRENCY|$
NLS_ISO_CURRENCY|AMERICA
NLS_NUMERIC_CHARACTERS|.,
NLS_CHARACTERSET|AL32UTF8
NLS_CALENDAR|GREGORIAN
NLS_DATE_FORMAT|DD-MON-RR
NLS_DATE_LANGUAGE|AMERICAN
NLS_SORT|BINARY
NLS_TIME_FORMAT|HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT|DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT|HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT|DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY|$
NLS_COMP|BINARY
NLS_LENGTH_SEMANTICS|BYTE
NLS_NCHAR_CONV_EXCP|FALSE
NLS_NCHAR_CHARACTERSET|AL16UTF16
NLS_RDBMS_VERSION|10.2.0.1.0