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

Ondrej Pokorny lazarus at kluug.net
Mon Aug 28 15:53:37 CEST 2023


when compiling a program with fpc on Windows, fpc seems to have the 
console output encoding wrong.

Example program (I am using "ä" because I am on german OS, so "ä" is in 
my DOS Latin and also in my ANSI codepage):

{$codepage utf8}
program TestNote;
{$note ä}

The console output is:

Free Pascal Compiler version 3.3.1 [2023/08/21] for i386
Copyright (c) 1993-2023 by Florian Klaempfl and others
(1002) Target OS: Win32 for i386
(3104) Compiling TestNote.lpr
p:\programs\_zk\TestNote\TestNote.lpr(6,2) Note: (2025) User defined: ä
(9015) Linking P:\programs\_zk\TestNote\lib\Debug\i386-win32\TestNote.exe
(1008) 8 lines compiled, 0.1 sec, 78736 bytes code, 2148 bytes data
(1022) 2 hint(s) issued
(1023) 1 note(s) issued

So it looks like the FPC compiler output is raw utf-8 instead of DOS 
Latin codepage. Is this wanted?

If yes, then Lazarus could take advantage of it and read the console 
output from FPC as UTF-8. Currently wrong characters are shown in 
Lazarus messages window on Windows.

If not and console (DOS Latin) codepage should be used by default, would 
it make sense to add a compiler command line option to set the output 
codepage? In that case Lazarus could tell FPC to use UTF-8.


More information about the fpc-devel mailing list