public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] mingw-host: Insert resource to enable UTF-8 active code page.
@ 2023-06-25 21:04 Costas Argyris
  0 siblings, 0 replies; only message in thread
From: Costas Argyris @ 2023-06-25 21:04 UTC (permalink / raw)
  To: binutils


[-- Attachment #1.1: Type: text/plain, Size: 319 bytes --]

When running in mingw host as Windows processes, the active code page used
today is the locale-specific codepage, which is not Unicode.

This patch builds the utf8 resource object file using windres and adds it
to LDFLAGS for mingw host, which makes all built executables use utf8
(65001 windows code page identifier).

[-- Attachment #2: 0001-mingw-host-Insert-resource-to-enable-UTF-8-active-co.patch --]
[-- Type: application/octet-stream, Size: 1849 bytes --]

From d2ece2affe3b0daa4641ece6068d7082df093bc3 Mon Sep 17 00:00:00 2001
From: Costas Argyris <costas.argyris@gmail.com>
Date: Sun, 25 Jun 2023 21:23:59 +0100
Subject: [PATCH] mingw-host: Insert resource to enable UTF-8 active code page.

---
 config/mh-mingw            | 6 ++++++
 config/utf8-mingw.manifest | 8 ++++++++
 config/utf8-mingw.rc       | 3 +++
 3 files changed, 17 insertions(+)
 create mode 100644 config/utf8-mingw.manifest
 create mode 100644 config/utf8-mingw.rc

diff --git a/config/mh-mingw b/config/mh-mingw
index a795096f038..c02a6ccb1be 100644
--- a/config/mh-mingw
+++ b/config/mh-mingw
@@ -11,3 +11,9 @@ STAGE4_CXXFLAGS += -D__USE_MINGW_ACCESS
 # as GCC turns out to need that much more to pass all the limits-* tests.
 LDFLAGS += -Wl,--stack,12582912
 BOOT_LDFLAGS += -Wl,--stack,12582912
+
+# UTF-8 resource object
+UTF8RES := `$(WINDRES) $(srcdir)/config/utf8-mingw.rc $$r/utf8res.o \
+&& echo $$r/utf8res.o`
+
+LDFLAGS += -Wl,$(UTF8RES)
\ No newline at end of file
diff --git a/config/utf8-mingw.manifest b/config/utf8-mingw.manifest
new file mode 100644
index 00000000000..0dff8970043
--- /dev/null
+++ b/config/utf8-mingw.manifest
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <application>
+    <windowsSettings>
+      <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
+    </windowsSettings>
+  </application>
+</assembly>
\ No newline at end of file
diff --git a/config/utf8-mingw.rc b/config/utf8-mingw.rc
new file mode 100644
index 00000000000..96c7237c6bc
--- /dev/null
+++ b/config/utf8-mingw.rc
@@ -0,0 +1,3 @@
+#include <winuser.h>
+
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "utf8-mingw.manifest"
\ No newline at end of file
-- 
2.41.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-25 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 21:04 [PATCH] mingw-host: Insert resource to enable UTF-8 active code page Costas Argyris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).