ofDirectory and accented characters

Hi,

I was playing with the dirListExample (from of0070, I don’t think that of0080 will make much difference to the problem) and got stuck with something related to accented characters.

Here’s an oversimplified block of code

ofDirectory d;
ofImage j;
d.listDir("C:\\OFX\\ofx_v0070_pre\\apps\\examples\\floatImages\\bin\\data");
d.allowExt("png");
for(int i=0;i<d.size();i++){
	ofFile f = d.getFile(i);
	if(f.isFile()){
		cout<<f.getAbsolutePath()<<endl;
		j.loadImage(f.getAbsolutePath());
	}
}

Now if I have a file called Über.png, the file won’t get loaded as the path returned from f.getAbsolutePath() has invalid characters.

I understand this is due to an encoding problem. However unlike console input/output, I don’t have control over the default encoding of ofFile/ofDirectory. (afaik)

I am pretty sure others may have encountered this. How do you get around this?
No, I don’t have control over the file names.
Yes, this is on a Windows 7 and VS2010. [chcp gives me an active code page 437]

Is there a default function or an addon (I did find a broken link to an addon which almost did things for something similar)?

Thanks.

Regards,
Abe

I’d invite you to try out https://github.com/bakercp/ofxIO for listing directories (both normally and recursively). There is also a directory watcher. I just tested it on Windows – so it should work pretty well …

Thanks bakercp. I will give this a try. I got pulled away for something else. Hence the delay.