Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with the filesystem::exists()
From: Lars Viklund (zao_at_[hidden])
Date: 2011-09-27 18:17:18

On Tue, Sep 27, 2011 at 01:04:36PM -0700, Brian Budge wrote:
> On Tue, Sep 27, 2011 at 12:49 PM, Danilo da Silveira Figueira
> <danilo_at_[hidden]> wrote:
> > I'm using WindowsXP but I need a solution that works on any version of
> > windows. The encoding of file names appears to be ANSI and the string that
> > was passed as a parameter seems to be UTF-8. Here is a link to the problem
> > that i'm having.
> >
> I believe it expects a std::string in ASCII or a std::wstring assuming
> UTF-16 on windows. If your file is not ascii, you need to either
> convert to the current internationalized code page (untested by me) or
> UTF-16.
> I had issues like this recently where on Linux we expect a std::string
> containing UTF-8, so we had the same thing happening on Windows. This
> didn't work for non-ascii items, so we convert to UTF-16 on windows,
> which then works properly.

Filesystem v3's path has functions and ctors accepting a
codecvt facet as last default argument, which defaults to a codecvt().

If my reading of the standard are correct, that implies that it uses the
current locale to convert filenames if needed.

If you want to always feed in UTF-8, you need to have a suitable codecvt

Lars Viklund | zao_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at