this is problem in fpc itself.
this simple testcase will fail:
program a;
{$MODE DELPHI}
uses
SysUtils, DB, memds;
var
mem: TMemDataset;
str, fld: WideString;
s: string;
begin
str := widechar(#$00E4) + widechar(#$00F6) + widechar(#$00FC); // 'äöü';
mem := TMemDataset.Create(nil);
try
mem.FieldDefs.Add('fld1', ftWideString, 20);
mem.Open;
mem.Insert;
mem.fields[0].asWideString := str;
mem.post;
fld := mem.fields[0].AsWideString;
if fld <> str then s := 'test is failed' else s := 'test is passed';
writeln(s);
finally
mem.Free;
end;
end.