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

Tomas Hajny XHajT03 at hajny.biz
Wed Aug 30 17:04:40 CEST 2023


On 2023-08-30 16:32, Ondrej Pokorny via fpc-devel wrote:
  .
  .
> If you mean
> https://stackoverflow.com/questions/56419639/what-does-beta-use-unicode-utf-8-for-worldwide-language-support-actually-do,
> then no, I don't have this option checked. However, even if I had it
> checked (I don't), it couldn't make a difference, because I didn't
> rely on the output displayed on console, but I actually checked the
> codepage of the compiler output by redirecting it to a file and
> checking the content of that file as well.
> 
> So did I:
> 
> See output.txt in the attachment. It is the output from redirection
> with "> output.txt". The output is double-encoded on my system (UTF-8
> as CP-850) - it means I have to convert it first from CP-850 to ANSI,
> then I see correct raw UTF-8 byte stream.

Interesting, but it doesn't change anything on the fact that my result 
is different (and correct) and I don't think that my configuration is 
special in any way...

Could you please change my test program sent earlier by changing 
"WriteLn (GetConsoleCP);" to "WriteLn (GetConsoleOutputCP);" recompile 
and check output of that one (GetConsoleCP is not useful in this 
context, that was my fault :-( ) - just in case?

Do you get a different behaviour if using a stock 3.2.2 compiler (the 
one distributed by the FPC team, not a Lazarus distribution)?

Tomas


More information about the fpc-devel mailing list