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

Ben Discoe ben at vterrain.org
Thu Sep 21 02:07:38 EDT 2006


Mateusz,

> >>> MSDN documents that there is a
> >>> (wchar_t*) version of std::ifstream() constructor 
> >>> (http://msdn2.microsoft.com/en-us/library/zek0beca.aspx),
> 
> Now, everything is clear. We're talking about two different 
> things, but that's because I've had no idea about this ctor.
> And because the problem is in the MSDN documentation :-)

Yes. :)

> second constructor you see, that takes const wchar_t* 
> parameter is a non-standard *extension* introduced by Microsoft.

Well sure.  So is _wfopen, and _wfopen is great.
The trouble here is not that it's a non-standard *extension*, but that it's
a non-standard *extension* which appears in the docs but not in the product.
:|

> That's why you can't find it in the MSVC++ 7.1

Well no, MSVC++ 7.1 has all of Microsoft's nonstandard extension, except
(apparently) this one.

> Because, what I'm expalining above, there is no wide-char 
> based ctor in basic_ifstream class, according to the C++ standard.

Yes, it's well known that the C and C++ standards are critically flawed in
that they only support a local charset, not unicode.  This discussion isn't
about standards, but about how we can implement support for all filenames in
GDAL.  Fortunately for GDAL, it (apparently) sticks to C stdlib, so we can
(thankfully) use _wfopen on Windows.

-Ben




More information about the Gdal-dev mailing list