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

Ondrej Pokorny lazarus at kluug.net
Thu Aug 31 18:19:31 CEST 2023


On 31.08.2023 17:54, Tomas Hajny via fpc-devel wrote:
> On 2023-08-31 17:08, Ondrej Pokorny via fpc-devel wrote:
>> :) We are not at the finish yet. Positive outcome will be when it gets
>> fixed in the compiler source.
>
> Yes, I know. I checked your patch briefly now and I don't like the 
> fact that it basically duplicates the code of the two original 
> TScannerFile methods. This isn't very good from maintainability point 
> of view, because if somebody changes/fixes some issue in one, (s)he 
> may easily forget about the other. I see several potential solutions:
>
> 2) Always use the ansistring version when parsing the comments. 
> Obviously, this increases compilation time for directives parsing 
> somewhat - we could possibly measure the impact and then decide if the 
> increase is important.

That is actually what I started with. Then I saw that there are some 
parts of the code that demand ShortString output and decided to keep 
both versions.

But basically it is possible to have the 2 ShortString variants use the 
new Long variants + check the Length and valid characters (to me it 
looks like there really should be checks for ASCII characters when 
ShortString is involved). That would be the simplest way to get rid of 
doubled code. I don't think the compiler performance will be affected 
that much and AFAIK maintainability is more important than performance 
anyway.

Or the bigger step would be to make the compiler unicode-ready:

var
   ä: string;

+ file names, paths etc.

Then only the new Long variant would be needed :)

Ondrej



More information about the fpc-devel mailing list