[fpc-devel] fpc compiler wrong encoding in console output on Windows

Ondrej Pokorny lazarus at kluug.net
Wed Aug 30 15:26:35 CEST 2023


On 30.08.2023 13:49, Mattias Gaertner via fpc-devel wrote:
> On 30.08.23 12:04, Tomas Hajny via fpc-devel wrote:
>> On 2023-08-28 15:53, Ondrej Pokorny via fpc-devel wrote:
>> [...]
>> Your output is different from mine (using a freshly compiled trunk 
>> compiler):
>> Free Pascal Compiler version 3.3.1 [2023/08/29] for i386
>> Copyright (c) 1993-2023 by Florian Klaempfl and others
>> Target OS: Win32 for i386
>> Compiling t2.pas
>> t2.pas(4,2) Note: User defined: ä
>
> Then you don't have default windows setup. Maybe you installed the cp 
> 65001?

Yes, Tomas, in other words: maybe you enabled "Beta support for UTF-8" 
in language options on your Windows?


>> [...]
>> However, I run the compiler from regular command line, not from Lazarus. 
>
> I get the same in cmd.exe and via TProcess.

Agreed.


>> [...] What do you get when running the following test program (you 
>> can simulate the same conditions e.g. by naming the resulting binary 
>> fpc.exe and configuring Lazarus to use this "compiler"):
>>
>> uses
>>   Windows;
>> begin
>>   WriteLn (GetACP);
>>   WriteLn (GetConsoleCP);
>
> ACP is 1252
> ConsoleCP 437

On my system:

ACP is 1252
ConsoleCP is 850

(437 is DOS-US, 850 is DOS-Latin-1)

https://en.wikipedia.org/wiki/Code_page_437
https://en.wikipedia.org/wiki/Code_page_850

Ondrej



More information about the fpc-devel mailing list