From 564aef68eec96dd8cb3e4e509e3b4fde362f3591 Mon Sep 17 00:00:00 2001 From: MouriNaruto Date: Sat, 17 Feb 2024 16:25:21 +0800 Subject: [PATCH] Add optional workaround for users who wants UTF-8 console output for LvglWindowsSimulator project. (Suggested by jinsc123654.) --- LvglWindowsSimulator/LvglWindowsSimulator.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/LvglWindowsSimulator/LvglWindowsSimulator.cpp b/LvglWindowsSimulator/LvglWindowsSimulator.cpp index 80134b3..af62c4e 100644 --- a/LvglWindowsSimulator/LvglWindowsSimulator.cpp +++ b/LvglWindowsSimulator/LvglWindowsSimulator.cpp @@ -10,9 +10,17 @@ int main() { lv_init(); - int32_t zoom_level = 100; - bool allow_dpi_override = false; - bool simulator_mode = true; + /* + * Optional workaround for users who wants UTF-8 console output. + * If you don't want that behavior can comment them out. + * + * Suggested by jinsc123654. + */ +#if LV_TXT_ENC == LV_TXT_ENC_UTF8 + SetConsoleCP(CP_UTF8); + SetConsoleOutputCP(CP_UTF8); +#endif + lv_display_t* display = lv_windows_create_display( L"LVGL Windows Simulator Display 1", 800,