[fpc-devel] TEncoding.Default and default encoding for TStrings.LoadFrom*()
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Dec 26 16:41:21 CET 2019
On Thu, 26 Dec 2019 16:15:03 +0100
Ondrej Pokorny <lazarus at kluug.net> wrote:
> Hello,
>
> a lot of people have a problem with the TStrings.LoadFrom*() changes
> when TEncoding support was added.
>
> Currently, the no-encoding overloads of TStrings.LoadFrom*() and
> TStrings.SaveTo*() use the TEncoding.Default, which is WIN-ANSI and
> not DefaultSystemCodePage.
It seems FPC 3.3.1 does use DefaultSystemCodePage:
class function TEncoding.GetANSI: TEncoding;
begin
....
if not Assigned(FStandardEncodings[seAnsi]) then
begin
// DefaultSystemCodePage can be set to non-ANSI
if Assigned(widestringmanager.GetStandardCodePageProc) then
FStandardEncodings[seAnsi] := TMBCSEncoding.Create(widestringmanager.GetStandardCodePageProc(scpAnsi))
else
FStandardEncodings[seAnsi] := TMBCSEncoding.Create(DefaultSystemCodePage);
...
end;
Maybe you are querying TEncoding.Default before changing
DefaultSystemCodePage?
Mattias
More information about the fpc-devel
mailing list