Check out attached demo project. It should shine some light for this matter.
You make the goal! The shown codepage in the console is
cp850 for the files cp1252.
If I change the project to something like
program project1;
{$codepage cp1252}
{$mode ObjFPC}{$H+}
uses windows;
var
s: String;
s2: ShortString;
begin
System.SetTextCodePage(Output, 1252);
s := #$80#$C4#$D6#$8C#$A5;
s2 := #$80#$C4#$D6#$8C#$A5;
writeln(s); // get: Ç─ÍîÑ
writeln(s2); // get: Ç─ÍîÑ
end.
I now got the same result for both, ShortString and String. It is a string represented by chars of codepage
850.
Quite confusing. I must first digest it.
Console is in OEMSTRING:
type
OemString = type AnsiString(CP_OEMCP);
if not already predefined.
A direct assigning of a constant to that new defined string doesn't work, only from a other string. But this is a new topic.
For me it was important to understand, if the statement "Shortstring: The code page of a shortstring is implicitly CP_ACP and hence will always be equal to the current value of DefaultSystemCodePage." is correct.
For files it is.
For the console too, but you can't get the displayed codepage with DefaultSystemCodePage, but with System.GetTextCodePage(Output).
Thank you all! For me this topic is solved!
I think, I'll create a new thread for a new topic.