[fpc-devel] How to set code page in terminal? (Windows)

Marco van de Voort marcov at stack.nl
Tue Aug 14 09:08:31 CEST 2012


In our previous episode, silvioprog said:
> ------------------------------------------------------------
> program test;
> 
> {$mode objfpc}{$H+}
> 
> {$IFDEF MSWINDOWS}
> uses
>   windows;
> {$ENDIF}
> 
> const
>   C = 'Aten??o';
> begin
> {$IFDEF MSWINDOWS}
>   SetConsoleOutputCP(CP_UTF8);
>   SetTextCodePage(Output, CP_UTF8);
> {$ENDIF}
>   WriteLn(C);
> end.
> ------------------------------------------------------------

Windows has two sets of console routines. One set that is universal over
win9x and WinNT, one that is WinNT only.

FPC uses the universal ones (still), the above code is WinNT only.
 



More information about the fpc-devel mailing list