May 08, 2023
https://issues.dlang.org/show_bug.cgi?id=23906

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net

--- Comment #1 from kinke <kinke@gmx.net> ---
I've fixed this for LDC (AFAIK :D), by IIRC:

* Switching the main() C entry point on Windows to wmain(), so that its gets
the cmdline params (source files, import dirs...) in UTF16 encoding, *not* the
current 8-bit code page (CP_ACP). `_d_wrun_main` in druntime then converts
those to proper UTF8 strings for _Dmain(). See:
https://github.com/dlang/dmd/blob/be151e6d854c0df8af7ee88b6f380b6283ea824f/compiler/src/dmd/mars.d#L872-L931
* Then redefining the `CodePage` enum in
https://github.com/dlang/dmd/blob/b87b011e0c91596b9722187192416a5a6534b16f/compiler/src/dmd/root/filename.d#L46
from `CP_ACP` to `CP_UTF8`.

That
https://github.com/dlang/dmd/blob/be151e6d854c0df8af7ee88b6f380b6283ea824f/compiler/src/dmd/common/string.d#L140
is new to me (and missed by LDC! - thx for the link) - it should definitely use
`dmd.root.filename.CodePage` instead (is currently a *private* enum).

> suggesting the conversion of CreateProcessA to instead be CreateProcessW with the help of toWStringZ

Yes, all child process invocations on Windows should use the wide API.

--
May 08, 2023
https://issues.dlang.org/show_bug.cgi?id=23906

--- Comment #2 from kinke <kinke@gmx.net> ---
[Oh, switching to wmain() shouldn't be required; _d_run_main in druntime ignores the narrow cmdline args anyway and properly converts the UTF16 ones to UTF8 for _Dmain.]

--