On Tuesday 12 November 2024 19:39:17 Lasse Collin wrote: > On 2024-11-12 Pali Rohár wrote: > > The only idea for FindFirstFileA/FindNextFindA which I have is to > > return "problematic" file names only in 8.3 notation. 8.3 notation is > > supported in all WinAPI calls, it is always in ASCII and has 1:1 > > mapping with the original UNICODE file name. The only downside is > > that it may have totally different name as expected and can be > > confusing. But I think it is still better than returning the "wrong" > > name which would alias with other file. > > The biggest downside is that on some file systems there are no 8.3 > names. 8.3 names can be disabled and stripped with "fsutil". Thus using > 8.3 names would workaround one issue but then be broken in a new way.
Ok, so it means that this workaround could work only in some cases and so generic solution. I do not have any idea how to fix it. > > Anyway, gcc / GNU LD still does not have support for marking PE binary > > as UTF-8 capable. So using UTF-8 code page for application linked by > > GNU LD is not an option for now. The reason is that GNU LD is not able > > to work with manifests (where are put all new PE flags / options). > > > > In past I reported this missing UTF-8 support into GNU LD bugzilla: > > https://sourceware.org/bugzilla/show_bug.cgi?id=30382 > > It's easy to include a manifest file using a short resource file: > > #include <winresrc.h> > CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest" > > The problem is that one has to provide a full manifest. As far as I > know, currently one cannot specify "add UTF-8 to the default manifest" > when using MinGW-w64. Yes, that it not possible and that I why I reported this bug. You can have maximally one resource object at link time, so this cannot be handled in mingw-w64 or in gcc. It is linker who is "joining" all input (object) files together into one final executable, so only linker can implement this functionality. Also the UTF-8-compatibility is the "flag" of the PE executable format and it is the linker who is generating PE executable. So really the UTF-8 compatibility flag needs to be set by the linker. GNU LD linker has already lot of other command line switches which adds (or clear) flags in PE executable. Just this UTF-8 compatibility flag needs to be put into manifest which is in resource, which is in resource section. So requires more work than just flipping bit in PE header. _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public