1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-20 17:08:00 +02:00

SetConsoleOutputCP(CP_UTF8)

This commit is contained in:
Brian Fiete 2022-03-02 07:38:29 -08:00
parent 8d6a29c16a
commit 080dadb24b

View file

@ -81,6 +81,8 @@ namespace System
return terminate ? false : true; return terminate ? false : true;
} }
//SetConsoleOutputCP set to CP_UTF8
[CLink, CallingConvention(.Stdcall)] [CLink, CallingConvention(.Stdcall)]
static extern Windows.IntBool SetConsoleTextAttribute(Windows.Handle hConsoleOutput, uint16 wAttributes); static extern Windows.IntBool SetConsoleTextAttribute(Windows.Handle hConsoleOutput, uint16 wAttributes);
@ -90,6 +92,9 @@ namespace System
[CLink, CallingConvention(.Stdcall)] [CLink, CallingConvention(.Stdcall)]
static extern Windows.Handle GetStdHandle(uint32 nStdHandle); static extern Windows.Handle GetStdHandle(uint32 nStdHandle);
[CLink, CallingConvention(.Stdcall)]
static extern Windows.IntBool SetConsoleOutputCP(uint32 wCodePageID);
[CallingConvention(.Stdcall)] [CallingConvention(.Stdcall)]
function Windows.IntBool ConsoleCtrlHandler(int32 ctrlType); function Windows.IntBool ConsoleCtrlHandler(int32 ctrlType);
[CLink, CallingConvention(.Stdcall)] [CLink, CallingConvention(.Stdcall)]
@ -111,6 +116,7 @@ namespace System
sOriginalForegroundColor.ConsoleTextAttribute = (uint8)(consoleInfo.mAttributes & 0xF); sOriginalForegroundColor.ConsoleTextAttribute = (uint8)(consoleInfo.mAttributes & 0xF);
sOriginalBackgroundColor.ConsoleTextAttribute = (uint8)(consoleInfo.mAttributes >> 4); sOriginalBackgroundColor.ConsoleTextAttribute = (uint8)(consoleInfo.mAttributes >> 4);
} }
SetConsoleOutputCP(/*CP_UTF8*/65001);
} }
#endif #endif