Created attachment 1080
source and exe
Can't open file.
Look in the archive
source:
-----------------------main.d
import std.stdio;
int main(string[] argv)
{
auto file2 = File("Привет.txt");
return 0;
}
---------------------------
Comment #1 by mk — 2012-03-10T16:21:07Z
(In reply to comment #0)
> auto file2 = File("Привет.txt");
Can't test with this filename as I have no Russian support, but it works for me with accented characters.
import std.stdio, std.stream;
void main(char[][] args)
{
char[] filename;
if (args.length==2)
filename=args[1];
else
filename="utfname-žlutý.txt";
writefln("filename: %s", filename);
File file = new File(filename);
}
However, what doesn't work is reading UTF8 from the commandline (using chcp 65001):
D:\devel\bugs>utfname
filename: utfname-žlutý.txt
D:\devel\bugs>utfname utfname-zluty.txt
filename: utfname-zluty.txt
D:\devel\bugs>utfname utfname-žlutý.txt
Error: 1invalid UTF-8 sequence
filename:
OS Windows XP Czech
Comment #2 by deep0125 — 2012-03-11T07:20:56Z
(In reply to comment #1)
> (In reply to comment #0)
> > auto file2 = File("Привет.txt");
>
> Can't test with this filename as I have no Russian support, but it works for me
Easy, download attached archive and extract to disk.
Comment #3 by mk — 2012-03-13T15:27:03Z
(In reply to comment #2)
> Easy, download attached archive and extract to disk.
OK, tried, same error as you reported.
Comment #4 by Oleg.Kuporosov — 2012-05-03T00:07:53Z
It doesn't look as a bug. Would you please elaborate why do you think so?
D itself (as source) is agnostic to Unicode version, but operation systems
where the source will be compiled and then run - not a all. What I mean - you can
have UTF8 source in Windows and even compile, but Windows itself (kernel, file systems, shell) is UTF16LE/ASCII only. The same time std.stdio doesn't promise to
auto convert your UTF8 string to UTF16 stringZ, it even doesn't know which coding you are using. So suggestion is to close this bug.
PS. Current std.stdio can't handle even UTF16LE (enhancement #8020), only ASCII names in Windows, workaround is to use ASCII only or std.stream or native Windows calls until probably new std.io (in hope it will support wstrings for names) will be finished and accepted into Phobos.
Comment #5 by verylonglogin.reg — 2012-07-06T00:27:11Z
(In reply to comment #1)
> However, what doesn't work is reading UTF8 from the commandline (using chcp
> 65001):
Your program is written in (outdated) D1 so you are affected by Issue 1188.
Comment #6 by verylonglogin.reg — 2012-07-06T00:54:48Z
*** Issue 8020 has been marked as a duplicate of this issue. ***
Comment #7 by verylonglogin.reg — 2012-09-11T13:57:31Z