Hmm, yes there is a problem
AnsiString is CP_ACP, that mean it will take DefaultSystemCodePage for converting
but in Windows, DefaultSystemCodePage set to utf-8 65001 , for that AnsiToUTF8 not work with me it convert from utf8 to utf8
if i fixed it by calling windows api GetACP that will fix it
This code work fine,
const
MyName: ansistring = #$D2#$C7#$E5#$D1;
begin
DefaultSystemCodePage := GetACP;
Edit1.Text := ansitoutf8(MyName);
end;
Now why DefaultSystemCodePage set to utf-8 65001 ?
in this file
\dev\fpc\3.0\src\rtl\win\syswin.inc: InitWin32Widestrings procedure it call GetACP
Some where DefaultSystemCodePage override set to utf8 in Windows