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

Mateusz Loskot mateusz at loskot.net
Tue Sep 19 14:45:51 EDT 2006


Ben Discoe wrote:
> Perhaps there is support for this somewhere in GDAL that i just haven't
> found yet?

The only solution I know is to use encoding-aware conversion from
Unicode to ANSI string, but it won't solve your problem
(http://www.mkssoftware.com/docs/man3/mbstowcs.3.asp).
It only will make it technically possible to pass strings between
Unicode API and ANSI-only API.

> Another option is for me to open the file first, e.g. for Windows:
> 	std::wstring fname;
> 	FILE *fp = _wfopen(fname, L"rb");
--------------------------^^^^^^^

A side note, there is no implicit conversion defined
between std::wstring and std::string
to const char* wchar_t and const char*.
You need to use fname.c_str().

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list