Thread overview
unicode filenames: std.stream.File and std.path.listdir
Jun 08, 2004
Walter
(fix) Re: unicode filenames: std.stream.File and std.path.listdir
June 07, 2004
Take this:

import std.stream;
void main ()
{
    auto File f = new File("año",FileMode.In);
    stdout.writeLine( f.readLine() );
}

If saved as 8-bit or UCS-2 (whatever that is), it doesn't work. In fact, it creates a new file named "año". But when saved as UTF-8 it works as expected.

The really bad part is that if instead I iterate over all the files (listdir(curdir)), it doesn't matter how I save it, it doesn't work anyway. Which means, the output from listdir can't be safely used with std.stream.File.

In conclusion, I believe that listdir should also return dchar [][] and wchar [][], and std.stream.File should accept wchar [] and dchar [] for filenames.

-----------------------
Carlos Santander Bernal


June 08, 2004
The bug is that std.stream needs to do the unicode conversions on the filenames like the std.file functions do.

BTW, thanks for thrashing this stuff for us.


June 09, 2004
"Walter" <newshound@digitalmars.com> escribió en el mensaje
news:ca3t1k$9ga$1@digitaldaemon.com
| BTW, thanks for thrashing this stuff for us.

No problem, I just try to help in any way I can.

-----------------------
Carlos Santander Bernal


June 09, 2004
"Walter" <newshound@digitalmars.com> escribió en el mensaje
news:ca3t1k$9ga$1@digitaldaemon.com
| The bug is that std.stream needs to do the unicode conversions on the
| filenames like the std.file functions do.
|
| BTW, thanks for thrashing this stuff for us.

Ok, this was easy. Attached is the fixed std.stream.
Note the lines 1330-1336: those could be removed if std.file.useWfuncs was
declared as package.

-----------------------
Carlos Santander Bernal