Boost logo

Boost :

From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2022-08-16 07:00:28


Am 15.08.22 um 23:10 schrieb Peter Dimov via Boost:
> Andrey Semashev wrote:
>> On 8/15/22 22:35, Peter Dimov via Boost wrote:
>>> The usual approach is to put
>>>
>>> boost::filesystem::path::imbue( std::locale( std::locale::classic(),
>>> new boost::filesystem::detail::utf8_codecvt_facet ) );
>> I'd rather
>>
>> boost::filesystem::path::imbue(boost::locale::generator()("C.UTF-8"));
>>
>> Don't recommend users to use stuff from namespace detail. :)
> Sound advice in principle but that's pretty much the established practice
> at this point. Perhaps we should expose a non-detail way to perform the
> above, such as provide a function "set_utf8_as_default".
Is it? I see `boost::locale::generator().generate("")` being used more
often, e.g. (quick Google search):
http://doc.aldebaran.com/1-14/ref/libqi/boost_filesystem_example_8cpp-example.html

And there is `boost::nowide::nowide_filesystem()` doing pretty much what
you suggest:
https://github.com/boostorg/nowide/blob/master/include/boost/nowide/filesystem.hpp#L20

Am 16.08.22 um 00:21 schrieb Andrey Semashev via Boost:
> On 8/16/22 01:07, Peter Dimov via Boost wrote:
>> Andrey Semashev wrote:
>>> Perhaps, move utf8_codecvt_facet to Utility or Core?
>> Maybe it's time. And make it all inline?
> Yes.
>
> Although there's this already:
>
> https://github.com/boostorg/locale/blob/develop/include/boost/locale/utf8_codecvt.hpp

And again in Nowide:
https://github.com/boostorg/nowide/blob/master/include/boost/nowide/utf8_codecvt.hpp

Am 16.08.22 um 01:53 schrieb Vinnie Falco via Boost:
> (where is the signature of fopen that accepts a filesystem::path?).
That's outside of its purpose: It is meant to accept narrow strings,
UTF-8 encoded where applicable.



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