[fpc-devel] fpc compiler wrong encoding in console output on Windows
Ondrej Pokorny
lazarus at kluug.net
Wed Aug 30 17:23:13 CEST 2023
On 30.08.2023 17:04, Tomas Hajny via fpc-devel wrote:
> 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...
Sorry to bother you with something as trivial: is your t2.pas file
really encoded in UTF-8?
Because if I compile an ANSI file with the {$codepage utf8} declaration,
then I get "correct" output. But obviously this is very wrong.
You can try yourself with the attached files. So maybe this is your mistake?
Ondrej
-------------- next part --------------
{$codepage utf8}
program TestNote;
uses
Windows;
begin
WriteLn (GetACP);
WriteLn (GetConsoleOutputCP);
{$note ä}
end.
-------------- next part --------------
{$codepage utf8}
program TestNote;
uses
Windows;
begin
WriteLn (GetACP);
WriteLn (GetConsoleOutputCP);
{$note ä}
end.
More information about the fpc-devel
mailing list