mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 03:27:12 +01:00
[vcpkg] use UTF-8 for console input/output
This commit is contained in:
parent
98ee8a949a
commit
af01792297
@ -18,6 +18,30 @@
|
|||||||
|
|
||||||
using namespace vcpkg;
|
using namespace vcpkg;
|
||||||
|
|
||||||
|
UINT console_cp_input;
|
||||||
|
UINT console_cp_output;
|
||||||
|
|
||||||
|
void console_cp_set()
|
||||||
|
{
|
||||||
|
console_cp_input = GetConsoleCP();
|
||||||
|
console_cp_output = GetConsoleOutputCP();
|
||||||
|
|
||||||
|
SetConsoleCP(CP_UTF8);
|
||||||
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void console_cp_reset()
|
||||||
|
{
|
||||||
|
SetConsoleCP(console_cp_input);
|
||||||
|
SetConsoleOutputCP(console_cp_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL console_ctrl_handler(DWORD fdwCtrlType)
|
||||||
|
{
|
||||||
|
console_cp_reset();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void invalid_command(const std::string& cmd)
|
void invalid_command(const std::string& cmd)
|
||||||
{
|
{
|
||||||
System::println(System::Color::error, "invalid command: %s", cmd);
|
System::println(System::Color::error, "invalid command: %s", cmd);
|
||||||
@ -192,6 +216,10 @@ int wmain(const int argc, const wchar_t* const* const argv)
|
|||||||
{
|
{
|
||||||
if (argc == 0) std::abort();
|
if (argc == 0) std::abort();
|
||||||
|
|
||||||
|
console_cp_set();
|
||||||
|
SetConsoleCtrlHandler(PHANDLER_ROUTINE(console_ctrl_handler), TRUE);
|
||||||
|
atexit(console_cp_reset);
|
||||||
|
|
||||||
*GlobalState::timer.lock() = ElapsedTime::create_started();
|
*GlobalState::timer.lock() = ElapsedTime::create_started();
|
||||||
|
|
||||||
// Checks::register_console_ctrl_handler();
|
// Checks::register_console_ctrl_handler();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user