Unicode: how to properly read and display directory entries?

Tyro[a.c.edwards] nospam at home.com
Fri Nov 5 05:59:09 PDT 2010


Hello,

What is the proper way to read a directory such that file names are not 
garbled? Here is the example I borrowed form the std.file documentation. 
Screen shots of folder is attached. Thanks.

void main(string[] args)
{
	bool callback(DirEntry* de)
	{
		if (de.isfile)
			mciPlay(toUTF8(de.name));
		return true;
	}

	listdir("snd", &callback);
}

D:\code>play
snd\american.ogg
snd\bigdog.flac
snd\blackmail.mp3
snd\ding.wav
snd\kam.aif.aiff
snd\豺。縺・ogg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: folder.jpg
Type: image/jpeg
Size: 11011 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20101105/7ab265ed/attachment.jpg>


More information about the Digitalmars-d-learn mailing list