Hi,
This should work on windows:
uses sysutils, windows;
function UTF8ToWideString(const AStr: String): WideString;
var
Len: Integer;
begin
Result := '';
if AStr <> '' then
begin
Len := MultiByteToWideChar(CP_UTF8, 0, PChar(AStr), -1, nil, 0);
SetLength(Result, Len - 1);
if Len > 1 then
MultiByteToWideChar(CP_UTF8, 0, PChar(AStr), -1, PWideChar(Result), Len - 1);
end;
end;
var
lpNumberOfCharsWritten: DWord;
Degree: WideString;
begin
Degree := UTF8ToWideString('°');
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), PWideChar(Degree), Length(Degree), lpNumberOfCharsWritten, nil);
Readln;
end.
Alternatively you can set the console code page with SetConsoleCP(CP_UTF8) command. You can also try CP_WINUNICODE.
regards,
GetMem