Fix bugs caused by encoding in the DMD compiler under Windows

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon May 8 15:49:26 UTC 2023


Okay lets go through all the proposed changes:

1.1
1.2
1.3

Okay reviewing where toWStringz is being used, yes, toWStringz should be 
converted to use CP_UTF8 not CP_ACP. Everything that uses it is either 
based upon cli or D source which is going to be UTF-8.

https://github.com/dlang/dmd/blob/be151e6d854c0df8af7ee88b6f380b6283ea824f/compiler/src/dmd/common/string.d#L136



2.1
2.2
2.3

Not needed.



2.4
2.5
2.6
2.7

These are unnecessary. The processing there only occurs for -lowmem switch.

Druntime will retrieve the CLI arguments separately and convert from 
UTF-16 before calling the D user main function (including for dmd).

https://github.com/dlang/dmd/blob/master/druntime/src/rt/dmain2.d#L268

Everything there is ok.



2.8
2.9
2.10

CreateProcessA has not been upgraded to include UTF-8 support, so that 
will need to be swapped out to be UTF-16.

https://github.com/dlang/dmd/blob/master/compiler/src/dmd/link.d#L892

Simple call into toWStringz will convert post OutBuffer no problem.



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


More information about the Digitalmars-d-ide mailing list