D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14474 - Use UTF-8 encoding for @cmdfile
Summary: Use UTF-8 encoding for @cmdfile
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P3 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-20 21:53 UTC by Dāvis
Modified: 2024-12-13 18:42 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dāvis 2015-04-20 21:53:18 UTC
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 Dāvis 2015-04-20 22:21:13 UTC
Created a quick PR https://github.com/D-Programming-Language/dmd/pull/4602
Comment 2 Martin Nowak 2015-04-22 00:08:17 UTC
(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 godmyoh 2019-11-02 08:30:30 UTC
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 dlangBugzillaToGithub 2024-12-13 18:42:23 UTC
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