Your pictures show that your console window is not using UTF8.
A call to SetConsoleOutputCP(CP_UTF8) should do that, if succeeded. Check that it does not return zero/false.
If it did fail, I'm not sure why. Maybe you need to check your:
Control Panel - Regional Settings - Advanced tab.
Notice that CP_UTF8 is 65001 and see the attached image.
Here is another test program that does not use any unit or define:
program project2;
{$mode objfpc}{$H+}
{$APPTYPE CONSOLE}
type
UINT = cardinal;
WINBOOL = longbool;
BOOL = WINBOOL;
var
PreviousValue: UINT;
i: integer;
c: LongWord;
Heart: String;
const
CP_UTF8 = 65001;
{$calling stdcall}
function GetConsoleOutputCP:UINT; external 'kernel32' name 'GetConsoleOutputCP';
function SetConsoleOutputCP(wCodePageID:UINT):WINBOOL; external 'kernel32' name 'SetConsoleOutputCP';
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; lpOverlapped: pointer): BOOL; external 'kernel32' name 'WriteFile';
begin
PreviousValue := GetConsoleOutputCP;
if SetConsoleOutputCP(CP_UTF8) then
begin
Heart := '♥';
if not WriteFile(StdOutputHandle,Heart[1],3,c,nil) then
WriteLn('WriteFile Failed: Sorry, no hearts for you! ');
SetConsoleOutputCP(PreviousValue);
end
else
WriteLn('SetConsoleOutputCP Failed: Sorry, no hearts for you! ');
end.
Edit:
The font I'm using is Lucida Console.