Is it working for you ? Or I misunderstood the problem.
You forgot to set the console output to UTF8. (As I wrote).
And you also need a terminal font that supports utf8
if you comment out the {$CODEPAGE UTF8} line, the compiler emits an error showing that it knows that the character does NOT fit in a single byte (type char.)
{$CODEPAGE UTF8} does not change the fact that a "char" can only accommodate a single byte (as shown above, the compiler knows that), therefore it should still emit an error.
It is a combination.???
Simplest example that basically changed 1 thing: char --> utf8char.Assumes your terminal/console is in utf8 mode.
{$ifdef fpc}{$mode objfpc}{$endif}{$codepage utf8} var alpha: Utf8Char; begin alpha := '°'; if alpha = '°' then WriteLn('It works!'); readln; end.
In a GUI app, take the original code and just change char to utf8char.