bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Use UTF-8 active code page for Windows host.


From: Costas Argyris
Subject: [PATCH] Use UTF-8 active code page for Windows host.
Date: Sat, 18 Mar 2023 16:37:20 +0000

Hi

This is a proposed patch to enable UTF-8 support in GNU Make running on Windows host.

Today, the make process on Windows is using the legacy system code page because of the "A" functions called in the source code.    This means that any UTF-8 input to make on Windows will break.    A few examples follow:

######################
C:\Users\cargyris\temp>cat utf8Makefile.mk
hello :
        @echo ﹏
        @echo ❎
C:\Users\cargyris\temp>mingw32-make -f utf8Makefile.mk
ï¹
âŽ

C:\Users\cargyris\temp>mingw32-make -f ❎\utf8Makefile.mk
mingw32-make: ?\utf8Makefile.mk: Invalid argument
mingw32-make: *** No rule to make target '?\utf8Makefile.mk'.  Stop.

C:\Users\cargyris\temp>cd ❎

C:\Users\cargyris\temp\❎>mingw32-make -f utf8Makefile.mk
mingw32-make: *** INTERNAL: readdir: Invalid argument.  Stop.

C:\Users\cargyris\temp\❎>mingw32-make -f ❎\utf8Makefile.mk
mingw32-make: ?\utf8Makefile.mk: Invalid argument
mingw32-make: *** INTERNAL: readdir: Invalid argument.  Stop.
######################

Hopefully the Unicode symbols are showing correctly in the email.    I used these:

https://www.compart.com/en/unicode/U+FE4F
https://www.compart.com/en/unicode/U+274E

The attached patch incorporates the UTF-8 manifest into the build process of GNU Make when hosted on Windows, and forces the built executable to use UTF-8 as its active code page, solving all problems shown above because this has a global effect in the process.    All existing "A" calls use the UTF-8 code page now instead of the legacy one.    This is the relevant Microsoft doc:

https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

With the patch, after building make, the above cases now work on Windows:

######################
C:\Users\cargyris\temp>cat utf8Makefile.mk
hello :
        @echo ﹏
        @echo ❎
C:\Users\cargyris\temp>make -f utf8Makefile.mk



C:\Users\cargyris\temp>make -f ❎\utf8Makefile.mk



C:\Users\cargyris\temp>cd ❎

C:\Users\cargyris\temp\❎>make -f utf8Makefile.mk



C:\Users\cargyris\temp\❎>make -f ❎\utf8Makefile.mk


######################

This change might also fix other existing issues on Windows having to do with filenames and paths, but I can't point at something particular right now.

Would a patch like that be considered?

Thanks,
Costas

Attachment: 0001-Use-UTF-8-active-code-page-for-Windows-host.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]