[Gdal-dev] Wide-character filenames with GDAL file IO?

Ben Discoe ben at vterrain.org
Sat Sep 9 06:36:59 EDT 2006


I am tring to convert my GDAL-based application to support international
characters in filenames.  So far, this has gone pretty well.  On Windows,
there are the _wfopen etc. methods which can take wide strings.  On Mac OS
X, the standard C library accepts UTF-8 in normal fopen().

However, i've got code calling GDAL functions like this one:
	char **CSLLoad(const char *pszFname)

I don't know how to pass my wide-string filenames to CSLLoad.  It seems to
expect only local charset encoded strings, which means i can't pass it a
filename containing e.g. Chinese characters.

Perhaps there is support for this somewhere in GDAL that i just haven't
found yet?

Another option is for me to open the file first, e.g. for Windows:
	std::wstring fname;
	FILE *fp = _wfopen(fname, L"rb");
	int fd = _fileno(fp);
Then i could pass the fd into GDAL, if it had a way of accepting it.

Help?

Thanks,
Ben




More information about the Gdal-dev mailing list