[fpc-pascal] Console Encoding in Windows (Local VS. UTF8)

Marco van de Voort marcov at stack.nl
Tue Jul 9 12:55:53 CEST 2013


In our previous episode, Michael Schnell said:
> Not a good idea.
> 
> The FPC developers are right now busy implementing the new Delphi 
> Strings. This _could_ mean that the application programmer can  use any 
> encoding (such as multiple different ANSI byte-codes, UTF-8, UTF-16, 
> ...), but in fact to be 100% Delphi compatible ("nothing less, nothing 
> more"), it seems that only UTF-16 will gain full decent support (e.g. 
> class inheritance, in TStringList, the Lazarus user API etc.)

Well, the main reason is not FPC, but Windows. UTF8 in Windows on _API_
level is simply not a good idea.

I have tried some programs/batchfiles that do chcp 65001  in  a cmd.exe, but
that doesn't really work nice. E.g. the "dir" command might simply fail
afterwards, and some foreign chars don't work properly either (some do
though!?!?) 

I mostly rewrote them to delphi console apps (the delphi RTL does everything
over -W functions).




More information about the fpc-pascal mailing list