[boost::locale or boost::nowide] C++23 char8_t. How to convert std::u8string <-> std::string?
Georg Gast via Boost-users <[email protected]> Tue, 2 Sep 2025 18:32:49 +0200
| Newsgroups | gmane.comp.lib.boost.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, as c++23 is now way out of the door and c++26 is already on the horizon, is there any thing in the boost libraries cor the "new" u8 literal and the new u8strings? I can only find mentioning char8_t in context of boost::filesystem. https://www.boost.org/doc/libs/latest/libs/nowide/doc/html/index.html#using For std::filesystem::path available since C++17 there is no way to imbue a locale. However the u8string() member function can be used to obtain an UTF-8 encoded string from a path. And to obtain a path from an UTF-8 encoded string you may use std::filesystem::u8path or since C++20 one of the path constructors taking a char8_t-type input. But it seems there is nothing like narrow() or widen() to convert from std::u8string <-> std::string (needed for non char8_t aware libraries). Think Win32 API. Is the only recommendation: Just stay on std::string and ignore char8_t? Still in 2025? Even with boost libraries? Bye Georg _______________________________________________ Boost-users mailing list -- [email protected] To unsubscribe send an email to [email protected] https://lists.boost.org/mailman3/lists/boost-users.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/[email protected]/message/JYVSEA43TLRBQ24U6K6EEVDHVKVBOCR6/