std.file and non-English filename in Windows

Domain dont_email at empty.com
Mon Jan 1 16:13:06 UTC 2018


On Monday, 1 January 2018 at 12:33:27 UTC, John Chapman wrote:
> On Sunday, 31 December 2017 at 18:21:29 UTC, Domain wrote:
>> In Windows, exists, rename, copy will report file not exists 
>> when you input non-English filename, such as Chinese 中文.txt
>
> Works for me. I created a file with the name "中文.txt" and 
> std.file.exists returned true.
>
> Is your D source file saved in ASCII by any chance? Try saving 
> it with a different encoding, such as UTF8.

Yes, "中文.txt".exists return true. But when then filename read 
from stdin,
it return false

stdin
     .byLineCopy(No.keepTerminator)
     .each!((a) { writefln("%s --> %s", a, a.exists); });

dir *.txt /b | test.exe

English.txt --> true
中文.txt --> false


More information about the Digitalmars-d-learn mailing list