[fpc-pascal] String literals and code page of .pas source file

LacaK lacak at zoznam.sk
Thu Sep 3 07:19:18 CEST 2020


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}

and in Lazarus I have set: File settings / Encoding / CP1250
(at this point in .pas file are all characters correctly encoded in 
Windows-1250 code page)

When I compile application and run it, string literals (characters with 
accents) are not preserved.
Is there way how to get it working?

Only work-around which worked for me (in both Delphi and Lazarus) was use:

const
   STRINGLITERAL1: WideString = 'áéíóčž';

Thanks

-Laco.



More information about the fpc-pascal mailing list