[Issue 23906] Unicode file names are not properly handled

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 8 16:46:03 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23906

kinke <kinke at gmx.net> changed:

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

--- Comment #1 from kinke <kinke at 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.

--


More information about the Digitalmars-d-bugs mailing list