================ @@ -76,6 +76,46 @@ using namespace lldb_private::line_editor; #endif // #if LLDB_EDITLINE_USE_WCHAR +#if LLDB_EDITLINE_USE_WCHAR +std::string ToBytes(const std::wstring &in) { + static std::locale locale("C.UTF-8"); + static const auto &cvt = + std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(locale); + + const size_t length = in.length(); + std::string output(length + 1, 0x0); + + std::mbstate_t mbs{}; + const wchar_t *in_next; + char *out_next; + + if (cvt.out(mbs, in.data(), in.data() + length + 1, in_next, output.data(), ---------------- labath wrote:
in.begin/end() ? https://github.com/llvm/llvm-project/pull/112582 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits