I find a error for oracle in Direct Mode about nvarchar2
I reproduced your issue for Server charset = ZHS16GBK and Windows default codepage = 936.
Direct=False & UseUniCode = False - works correct
Direct=False & UseUniCode = True - works correct
Direct=True & UseUniCode = False - works incorrect !!!
Direct=True & UseUniCode = True - works correct
Please confirm the result of my tests.
I am going to fix the bug for the mode: Direct=True & UseUniCode = False. If you have invalid result for other modes, please notify me.
Direct=False & UseUniCode = False - works correct
Direct=False & UseUniCode = True - works correct
Direct=True & UseUniCode = False - works incorrect !!!
Direct=True & UseUniCode = True - works correct
Please confirm the result of my tests.
I am going to fix the bug for the mode: Direct=True & UseUniCode = False. If you have invalid result for other modes, please notify me.
i am glad to get your result:
Direct=False & UseUniCode = False - works correct
Direct=False & UseUniCode = True - works correct
Direct=True & UseUniCode = False - works incorrect !!!
Direct=True & UseUniCode = True - works correct
my test in winXP is same with you .
but In win7,Direct=False & UseUniCode = False has wrong .
for example ,if you field is varchar2(5), then
you can write '戴大达' in DbEdit,but when you post ;
'戴大达' =>'戴大?';
if at winXP or Win2003 ,the result is '戴大达' =>'戴大' ,this is OK.
if you are not mind of you new code ; can you give the code you fixed to me ; my e-mail :[email protected] , i'll try my best to help you test
Direct=False & UseUniCode = False - works correct
Direct=False & UseUniCode = True - works correct
Direct=True & UseUniCode = False - works incorrect !!!
Direct=True & UseUniCode = True - works correct
my test in winXP is same with you .
but In win7,Direct=False & UseUniCode = False has wrong .
for example ,if you field is varchar2(5), then
you can write '戴大达' in DbEdit,but when you post ;
'戴大达' =>'戴大?';
if at winXP or Win2003 ,the result is '戴大达' =>'戴大' ,this is OK.
if you are not mind of you new code ; can you give the code you fixed to me ; my e-mail :[email protected] , i'll try my best to help you test
I made my test ,Please See this video:
http://www.daizhicun.com/unidac/uniDac.html
and i hope you give the fixed code to me :[email protected]
i will test it carefully.
http://www.daizhicun.com/unidac/uniDac.html
and i hope you give the fixed code to me :[email protected]
i will test it carefully.
In this:
http://www.daizhicun.com/unidac/uniDac.html
it shows many bugs;
but in fact ,the bugs about chinese is more then it showed ;
so ,we must test and test ;
http://www.daizhicun.com/unidac/uniDac.html
it shows many bugs;
but in fact ,the bugs about chinese is more then it showed ;
so ,we must test and test ;
or you can download my test:
http://www.daizhicun.com/unidac/uniDac.mp4
http://www.daizhicun.com/unidac/uniDac.mp4
Hello
I reproduced the issue from the video. It seems like Delphi bug or Oracle bug. Let consider the sample:
We want to save the "漢語3金金金" value to NVARCHAR(5) field. In any case TStringField call the TStringField.SetAsAnsiString method in the DB unit and convert your WideStrng to AnsiString: "漢語3金金金" = $9D $68 $D5 $5A $33 $BD $F0 $BD $F0 $BD $F0 (11 bytes in UTF8 for AnsiString).
The TStringField.SetAsAnsiString cut this string to 10 byte (field has size 10):
4. Write request to Embarcadero and ask them to develop fix for the TStringField.SetAsAnsiString method.
I reproduced the issue from the video. It seems like Delphi bug or Oracle bug. Let consider the sample:
We want to save the "漢語3金金金" value to NVARCHAR(5) field. In any case TStringField call the TStringField.SetAsAnsiString method in the DB unit and convert your WideStrng to AnsiString: "漢語3金金金" = $9D $68 $D5 $5A $33 $BD $F0 $BD $F0 $BD $F0 (11 bytes in UTF8 for AnsiString).
The TStringField.SetAsAnsiString cut this string to 10 byte (field has size 10):
Code: Select all
procedure TStringField.SetAsAnsiString(const Value: AnsiString);
var
Len: Integer;
PBuf: PAnsiChar;
Temp: AnsiString;
Buffer: array[0..dsMaxStringSize] of AnsiChar;
begin
if DataSize > SizeOf(Buffer) then
begin
SetLength(Temp, strlen(PAnsiChar(Value))+1);
PBuf := PAnsiChar(Temp);
Len := StrLen(PAnsiChar(Value));
end else
begin
PBuf := Buffer;
Len := Size;
end;
StrLCopy(PBuf, PAnsiChar(Value), Len); SizeOf(Buffer) then
begin
SetLength(Temp, strlen(PAnsiChar(Value))+1);
PBuf := PAnsiChar(Temp);
Len := StrLen(PAnsiChar(Value));
end else
begin
PBuf := Buffer;
Len := Size;
end;
// cut string
Temp := copy(Value, 1, Len);
// $9D $68 $D5 $5A $33 $BD $F0 $BD $F0 $BD -> $9D $68 $D5 $5A $33 $BD $F0 $BD $F0 (remove remains of characters)
Temp := WideString(Temp);
// copy the value to the buffer
StrLCopy(PBuf, PAnsiChar(Temp), Len);
// StrLCopy(PBuf, PAnsiChar(Value), Len);
if Transliterate then
DataSet.Translate(PBuf, PBuf, True);
SetData(PBuf);
end;