Bug 14474 – Use UTF-8 encoding for @cmdfile

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2015-04-20T21:53:18Z
Last change time
2024-12-13T18:42:23Z
Assigned to
No Owner
Creator
Dāvis
Moved to GitHub: dmd#17704 →

Comments

Comment #0 by davispuh — 2015-04-20T21:53:18Z
Currently `dmd @cmdfile` will read file as simple char string. But when DUB is compiling and creating this file it always saves it in UTF-8. This makes a problem when cmdfile contains paths (source files) with non-ASCII paths/names and thus DMD interprets them incorrectly (it always uses WinAPI ANSI functions which expects them to be encoded in Windows default ANSI code page) Such cmdfile file with non-ASCII paths encoded as UTF-8 will produce "Error: cannot read file" One solution could be to change DUB to save it in Windows default ANSI code page, but I think that's a very bad idea because then that file won't be portable. So best would be to enforce it being in UTF-8 encoding and then decode in DMD for respective code page which is used for WinAPI calls.
Comment #1 by davispuh — 2015-04-20T22:21:13Z
Comment #2 by code — 2015-04-22T00:08:17Z
(In reply to Dāvis from comment #0) > One solution could be to change DUB to save it in Windows default ANSI code > page, but I think that's a very bad idea because then that file won't be > portable. It doesn't need to be portable, it's just used for a single compiler invocation. > So best would be to enforce it being in UTF-8 encoding and then decode in > DMD for respective code page which is used for WinAPI calls. UTF-8 sounds reasonable.
Comment #3 by menodinulla — 2019-11-02T08:30:30Z
Is anyone working on this issue? This PR is closed but doesn't seem to be resolved. https://github.com/dlang/dmd/pull/4602
Comment #4 by robert.schadek — 2024-12-13T18:42:23Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17704 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB