Post Unicode in Delphi5, when UseUnicode=True & Direct=True
Post Unicode in Delphi5, when UseUnicode=True & Direct=True
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.
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.
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).
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).
Thanks for reply.
"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.
Some other solution?
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: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.
"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.
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).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).
Some other solution?
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.
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.
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.
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.
Just a moment... AlexP, but you wrote:
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
This means that you have reproduced the problem on other regional language settings, other than Romanian. Is not it? Or have I misunderstood you?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.
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