Page 2 of 2

Posted: 10.03.2012, 18:10
by EgonHugeist
Hmm here i thing the Grid did not update the TField. Which means press insert on the DBNavigator then type in your russian chars. Change the cursor-position to your id Field. And click post on the Navigator. Are the changes posted? If this is true then Zeos isn't the Problem here...

Posted: 10.03.2012, 19:29
by ism
Change the cursor-position to your id Field
Yes, problem with update dbgrid

Image
Image
Image

Posted: 10.03.2012, 21:22
by ism
I test with standart sqldb lazarus components IBConnection, bug present, this problem in lazarus

Posted: 11.03.2012, 19:26
by EgonHugeist
ism,

report the problem to FPC/Lazarus-Forum..

Posted: 23.03.2012, 17:42
by marcov
EgonHugeist wrote: Eventually the FPC UTF8ToAnsi doesn't work for Linux..
That's something i wanted to do long times before.
Note that "ansi" is a dangerous term. It might be UTF8.

In bpoth FPC and Delphi terms it means "the system 1-byte encoding", which on *nix can be (and often is in full size distributions) UTF-8

Note that to keep depencies low, on Linux and FreeBSD the "cwstring" unit must be included in the project to enable unicode support (automatic conversions between ansistring and unicodestring, as well as all other conversions provided by FPC).

Posted: 24.03.2012, 12:43
by ism
In svn lazrus trunk , fixed , test it
http://bugs.freepascal.org/view.php?id=21489

Posted: 27.03.2012, 21:08
by EgonHugeist
marcov,

marcov wrote: function TZAbstractCachedResultSet.GetString(ColumnIndex: Integer; const CharEncoding: TZCharEncoding = {$IFDEF FPC}ceUTF8{$ELSE}ceAnsi{$ENDIF}): Ansistring;
var
UseEncoding: TZCharEncoding;
WS: WideString;
begin
{$IFNDEF DISABLE_CHECKING}
CheckAvailable;
{$ENDIF}
if CharEncoding = ceDefault then
UseEncoding := ClientCodePage^.Encoding
else
UseEncoding := CharEncoding;

case ClientCodePage^.Encoding of
ceAnsi:
case UseEncoding of
ceAnsi: Result := AnsiString(FRowAccessor.GetString(ColumnIndex, LastWasNull));
ceUTF8: Result := AnsiToUTF8(FRowAccessor.GetString(ColumnIndex, LastWasNull));
ceUTF16:
begin
WS := UTF8ToString(AnsiToUTF8(FRowAccessor.GetString(ColumnIndex, LastWasNull)));
Result := Copy(UTF8Encode(WS), 1, Length(UTF8Encode(WS)));;
end;
{$IFNDEF MSWINDOWS}
ceUTF32: ;
{$ENDIF}
end;
ceUTF8:
case UseEncoding of
ceAnsi: Result := AnsiString(UTF8ToAnsi(FRowAccessor.GetString(ColumnIndex, LastWasNull)));
ceUTF8: Result := AnsiString(FRowAccessor.GetString(ColumnIndex, LastWasNull));
ceUTF16:
begin
WS := FRowAccessor.GetUnicodeString(ColumnIndex, LastWasNull);
Result := Copy(UTF8Encode(WS), 1, Length(UTF8Encode(WS)));;
end;
{$IFNDEF MSWINDOWS}
ceUTF32: ;
{$ENDIF}
end;
ceUTF16: ;
{$IFNDEF MSWINDOWS}
ceUTF32: ;
{$ENDIF}
end;
end;
This function returns always Ansi-one-byte chars so thats absolutly wanted in this case. Do you see issus here?

I only changed the defaults of the cached-resultsets. This is a patch i've implemented because of some old detected bugs (in UTF8-Mode). The theme was editing/posting some ascendent-chars and compare them with source constants. This was impossible with delphi and a Unicode-Connection...