Boost logo

Boost :

Subject: Re: [boost] [filesystem] path does not use global locale's codecvt facet - bug or feature
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-03-03 10:02:33


On 3/3/2011 8:31 AM, Artyom wrote:
> Hello,
>
> Boost.Filesystem v3 uses wide path under windows and can convert it from the
> narrow
> one using codecvt facet, so I would expect if the global locale is some locale
> that has special codecvt facet installed boost.filesystem should use it, i.e.:
>
> int main()
> {
> boost::locale::generator locale_generator;
> std::locale::global(locale_generator("en_US.UTF-8"));
> // Now default codecvt facet is UTF-8 one.
> boost::filesystem::path p("שלום.txt");
> boost::filesystem::ofstream test(p);
> }
>
> However this does not work as expected!
>
> I had found that you need to imbue locale explicitly:
>
>
> boost::filesystem::path p;
> p.imbue(std::locale()); // global one
> p = "שלום.txt";
> boost::filesystem::ofstream test(p);
>
> Now it works.
>
> Should I open a ticket for this or this is "planned"
> behavior?

If it is documented, then it seems to me that this would be the normal
behavior. If it is not documented I would open a ticket about it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk