[fpc-devel] fpc compiler wrong encoding in console output on Windows
Ondrej Pokorny
lazarus at kluug.net
Thu Aug 31 17:08:25 CEST 2023
Am 31.08.2023 um 9:59 schrieb Tomas Hajny via fpc-devel:
> On 2023-08-30 23:38, Ondrej Pokorny via fpc-devel wrote:
>> Am 30.08.2023 um 20:21 schrieb Ondrej Pokorny via fpc-devel:
>>> Having seen the outputs, I think that the compiler just ignores the
>>> source file encoding for {$MESSAGE} and {$NOTE}. It reads them
>>> always as ANSI and then converts them to DOS-whatever.
>>>
>>> That would explain why UTF-8 byte stream is encoded into DOS CP.
>>>
>>> So the fix should be quite easy - when {$MESSAGE} or {$NOTE} is read
>>> into a string, set the correct codepage of the string.
>>
>> I was correct in my assumption and I was able to fix it:
>> https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/482
>>
>> On the other hand, when I read the $CODEPAGE docs:
>> https://www.freepascal.org/docs-html/prog/progsu87.html#x95-940001.3.4
>> There it is stated that only literal strings follow $CODEPAGE and the
>> actual code must be in US-ASCII.
>>
>> But you know: Delphi compatibility :) ...and there is no "illegal
>> character" compiler error as it is for:
>>
>> var
>> ä: string;
>>
>> so one would expect {$note ä} to show up correctly.
>
> Indeed. I'm glad that our discussion (although triggered by my mistake
> :-( ) led to a positive outcome at last. :-)
:) We are not at the finish yet. Positive outcome will be when it gets
fixed in the compiler source.
Ondrej
More information about the fpc-devel
mailing list