[fpc-devel] TEncoding.Default and default encoding for TStrings.LoadFrom*()

Michael Van Canneyt michael at freepascal.org
Fri Dec 27 00:19:06 CET 2019



On Thu, 26 Dec 2019, Ondrej Pokorny wrote:

> On 26.12.2019 19:29, Michael Van Canneyt wrote:
>> So no, I don't think these need to be changed/merged. What IMO can be 
>> discussed is
>> which of these 2 need to be used as the default codepage in other 
>> code. It
>> should then resolve the problems that appear, I think.
>
> That would be possible as well. But still please reconsider it:
> One reason: just from the convention - the default codepage to use 
> should be TEncoding.Default. That is intuitive.
>
> Second reason: Now we have TEncoding.ANSI = TEncoding.Default. 2 equal 
> properties. And another FPC-only property TEncoding.SystemEncoding. That 
> means 3 properties for 2 values.

As far as I know, TEncoding.ANSI = CP_ACP. 
Why should this equal TEncoding.Default ? 
I think  TEncoding.Default  = CP_UTF8 on linux ?

The main problem I see is that there is the system (OS) encoding, and the
encoding specified by DefaultSystemCodePage.

These do not necessarily agree. So it makes sense to have 2 TEncodings: one
for the system encoding, one for the DefaultSystemCodePage variable. They
will not be equal.

If they were, then the DefaultSystemCodePage variable makes no sense whatever.

Michael.


More information about the fpc-devel mailing list