This is obviously related to the DMC runtime library (snn.lib). It pretty
freqently gets reported by mostly Russian speaking DUB users, because their
home directory contains Cyrillic characters.
DMD only accepts files that contain ASCII characters (maybe even LATIN1).
Everything else results in an error message similar to this:
$ dmd тєѕт.d
Error: cannot read file ????.d
Reproducible with any Cyrillic character.
See also https://github.com/D-Programming-Language/dub/issues/420
Comment #1 by dlang-bugzilla — 2014-09-21T01:50:26Z
I think this issue is already reported elsewhere.
As of DMD 2.066, you can use windowsHandleOpen to create std.stdio.File objects from arbitrary HANDLEs. This allows circumventing snn.lib's Unicode problems if you can replace File creation with custom code.
I've done this for another reason, accessing very long paths using the UNC path prefix: https://github.com/CyberShadow/ae/blob/master/sys/file.d#L686-L737
Comment #2 by sludwig — 2014-09-21T06:36:36Z
Just to make sure that there is no misunderstanding, this is about an issue with the DMD command line executable, not about the Phobos issue. I've searched for various keywords but couldn't find any existing issue, even if I would have assumed that something already exists.
Comment #3 by dfj1esp02 — 2014-09-21T11:09:30Z
(In reply to Vladimir Panteleev from comment #1)
> snn.lib's Unicode problems
snn has problems with unicode?
Comment #4 by dlang-bugzilla — 2014-09-21T15:23:16Z
Yes, sorry, got confused halfway thinking of a similar issue affecting D programs built with DMD.
Comment #5 by dlang-bugzilla — 2014-09-21T15:31:10Z
(In reply to Sobirari Muhomori from comment #3)
> snn has problems with unicode?
Yes. See issue 7648
Comment #6 by dlang-bugzilla — 2014-09-21T15:44:47Z
(In reply to Sönke Ludwig from comment #0)
> DMD only accepts files that contain ASCII characters (maybe even LATIN1).
> Everything else results in an error message similar to this:
>
> $ dmd тєѕт.d
> Error: cannot read file ????.d
>
> Reproducible with any Cyrillic character.
With DMD 2.066:
> dmd тест.d
Error: invalid file name '.d'
> dmd "тест.d"
(works, and creates тест.exe)
So, I guess it will still accept characters in the user's code page, as long as they are quoted.
Comment #7 by dfj1esp02 — 2014-09-22T11:21:38Z
(In reply to Vladimir Panteleev from comment #5)
> (In reply to Sobirari Muhomori from comment #3)
> > snn has problems with unicode?
>
> Yes. See issue 7648
Do you mean this line: https://github.com/D-Programming-Language/phobos/blob/master/std/stdio.d#L3145 ?
Hmm... how does it work? Accepts ansi-encoded string, transcodes it from utf8 to utf16 somehow keeping invalid utf8 sequences, then _wfopen transcodes it back to utf8 and passes to CreateFileA?
Comment #8 by robert.schadek — 2024-12-13T18:27:31Z