@ertank, I can't test but try:
TEncoding.FreeEncodings;
e := TEncoding.GetEncoding(DefaultSystemCodePage);
I am not sure what you need me to do. My initial code which has a problem is as following. Would you modify it the way I should do your test? Please note that I currently do not use LazUTF8 unit anywhere in my project. It is actually targeting arm-wince platform.
You don't have to use LazUTF8
directly. It is enough to have it in your project through some other unit. Since your project is a GUI application, LazUTF8 is included.
Now there is another bug related to TEncoding. To make sure simply do the following:
uses
Base64;
var
ct1: array [1..7] of Char; // Using AnsiChar do not help either
begin
{//Before: These two are not identical
WriteLn('DefaultSystemCodePage: ', DefaultSystemCodePage); //65001
WriteLn('TEncoding.Default: ',TEncoding.Default.EncodingName);//Windows-1254
}
TEncoding.FreeEncodings;
TMBCSEncoding.Create;
{//After: These two should be identical
WriteLn('DefaultSystemCodePage: ', DefaultSystemCodePage);//65001
WriteLn('TEncoding.Default: ',TEncoding.Default.EncodingName);//UTF8
}
ct1 := DecodeStringBase64('7EFBZP6kPw==');
// ct1 end up with following information in debug value check
// #195 #172 A A d #197 #159
end;