www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14474] New: Use UTF-8 encoding for cmdfile

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

          Issue ID: 14474
           Summary: Use UTF-8 encoding for  cmdfile
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: davispuh gmail.com

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.

--
Apr 20 2015