Andrey Semashev wrote:
On 8/15/22 22:35, Peter Dimov via Boost wrote:
Vinnie Falco wrote:
On Mon, Aug 15, 2022 at 11:28 AM Peter Dimov via Boost
wrote: That's why I think that the only sensible interpretation of paths coming from URLs is as UTF-8, and for this case, the default filesystem conversion isn't suitable.
Can you please submit a pull request showing me how route.cpp can be correctly implemented according to these semantics?
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".
Note though that after that call all narrow strings you pass to filesystem::path must be UTF-8; you should be careful if you obtain paths from user input, files, network, etc.
Right. That's why I alluded to the alternative, using the codecvt_type overloads.