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

Ondrej Pokorny lazarus at kluug.net
Wed Aug 30 16:32:12 CEST 2023


On 30.08.2023 16:23, Tomas Hajny via fpc-devel wrote:
> On 2023-08-30 15:26, Ondrej Pokorny via fpc-devel wrote:
>> On 30.08.2023 13:49, Mattias Gaertner via fpc-devel wrote:
>>> On 30.08.23 12:04, Tomas Hajny via fpc-devel wrote:
>>>> On 2023-08-28 15:53, Ondrej Pokorny via fpc-devel wrote:
>>>> [...]
>>>> Your output is different from mine (using a freshly compiled trunk 
>>>> compiler):
>>>> Free Pascal Compiler version 3.3.1 [2023/08/29] for i386
>>>> Copyright (c) 1993-2023 by Florian Klaempfl and others
>>>> Target OS: Win32 for i386
>>>> Compiling t2.pas
>>>> t2.pas(4,2) Note: User defined: ä
>>>
>>> Then you don't have default windows setup. Maybe you installed the 
>>> cp 65001?
>>
>> Yes, Tomas, in other words: maybe you enabled "Beta support for UTF-8"
>> in language options on your Windows?
>
> 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.

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20230830/1d61cf6f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mi69zxKNvNror70o.png
Type: image/png
Size: 22990 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20230830/1d61cf6f/attachment-0001.png>
-------------- next part --------------
Free Pascal Compiler version 3.3.1 [2023/08/21] for i386
Copyright (c) 1993-2023 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling TestNote.lpr
TestNote.lpr(11,3) Note: User defined: اد
Linking TestNote.exe
13 lines compiled, 0.1 sec, 39232 bytes code, 1412 bytes data
1 note(s) issued


More information about the fpc-devel mailing list