Am 03.09.2020 um 07:19 schrieb LacaK via fpc-pascal:
Hi *,
I would like to have source file in Windows-1250 encoding, where are
stored literal strings like 'áéíóčž' in Windows-1250 encoding (I share
this one file between FPC/Lazarus and Delphi 7). Windows-1250 is also
ANSI code page of my Windows OS. In source file I have:
{$IFDEF FPC}
{$CODEPAGE cp1250}
{$ENDIF}
A pure string constant will still have CP_ACP as code page (which in
Lazarus will by default mean UTF-8) also when you declare it as a typed
String constant. The $CodePage directive will only influence the binary
encoding of the string. What you need to do is the following:
type
String1250 = type String(1250);
const
MyString: String1250 = 'áéíóčž';
This way the string itself will have code page 1250 and if you assign to
a normal String or a UnicodeString the compiler will insert the
appropriate conversions.
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal