[PATCH] Set correct Windows console code page since all LyX output is, in UTF-8

Yuriy Skalko yuriy.skalko at gmail.com
Thu Mar 11 14:30:39 UTC 2021


Now all LyX console output other than ASCII is broken since LyX outputs 
UTF-8, but the default code page in Windows console is not UTF-8 and 
depends on the locale 
(https://docs.microsoft.com/en-us/windows/console/console-code-pages).

Attached patch fixes this issue. Is it OK to commit?


Yuriy
-------------- next part --------------
From 56cc76bff7e91ab4dedda0281ae9c4926121b176 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 11 Mar 2021 16:19:44 +0200
Subject: [PATCH] Set correct Windows console code page since all LyX output is
 in UTF-8

---
 src/main.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main.cpp b/src/main.cpp
index 94b1ccd646..65a9f4d8d7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -40,6 +40,7 @@ int main(int argc, char * argv[])
 		freopen("CONOUT$", "w", stdout);
 		freopen("CONOUT$", "w", stderr);
 	}
+	SetConsoleOutputCP(CP_UTF8);
 #endif
 
 	// To avoid ordering of global object problems with some
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list