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

Tomas Hajny XHajT03 at hajny.biz
Thu Aug 31 17:54:39 CEST 2023


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:

1) Keep the original methods and perform codepage translation only in 
dir_message. I understand that it keeps the current limitation of the 
message length (which may lead to broken UTF-8 string among others), but 
it's questionable whether that really matters, IMHO, or whether it could 
just be documented as a limitation.

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.

3) Find some smart way how to share the same code for both ansistring 
and shortstring version (preferably without generics ;-) ). I don't know 
if this option is feasible, but it might be a good one if so.

Tomas


More information about the fpc-devel mailing list