lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] MinGW, wstring, and wstream [Was: patch: compilation fix for w


From: Greg Chicares
Subject: Re: [lmi] MinGW, wstring, and wstream [Was: patch: compilation fix for wx 2.9]
Date: Sat, 15 May 2010 15:04:29 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

On 2010-05-15 13:13Z, Vadim Zeitlin wrote:
> On Sat, 15 May 2010 12:59:12 +0000 Greg Chicares <address@hidden> wrote:
> 
> GC> On 2010-05-15 12:30Z, Vadim Zeitlin wrote:
[...]
> GC> >  MinGW 3.x console IO doesn't support Unicode AFAIK. But this is not the
> GC> > main problem, it's the lack of support for Unicode file names in
> GC> > std::fstream (and lack of extensions in GNU C++ library to remedy this)
> GC> > that is. IOW we can support Unicode file names with MinGW, of course. 
> But
> GC> > only using wx and not std::fstream.
> GC> 
> GC> MinGW provides wstring, but not wstream:
> 
>  Sorry, this is irrelevant. We don't need wstream because we don't need to
> work with Unicode file contents. We just want to be able to open files with
> Unicode names and this isn't helped by using wstream as its ctor (and the
> underlying std::basic_filebuf::open() method) still take "const char *"
> only and not "const wchar_t *" (which is a MSVC extension).

Then have I misunderstood the problem? Here's what doesn't work with
wide-character filenames:

  bool CensusDocument::OnCreate(wxString const& filename, long int flags)
  ...
          std::ifstream ifs(filename.mb_str());

The standard C++2003 library provides only one non-default ctor:

  explicit basic_ifstream(const char* s, ios_base::openmode mode = 
ios_base::in);

so we'd need a 'char const*' argument even for std::wifstream. And
N3092 adds a ctor with a 'string const&' argument, but that's still
narrow--it's not a std::wstring.

Does this mean that we can't use Unicode names with std::basic_fstream?
Is that the problem? If so, is it inherent in the standard, or just a
shortcoming of the MinGW implementation?

I'm guessing that it's inherent in the standard, because boost adds
  explicit basic_ifstream( const wpath & file_ph );
So will we need an extension like that in order to support Unicode
filenames someday?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]