From e420e014cc6a39d6a4dea244cba1f18cd38ed74b Mon Sep 17 00:00:00 2001 From: zourongchun Date: Sat, 14 Dec 2024 10:11:34 +0800 Subject: [PATCH] cherry pick 1426074 from https://gitee.com/zourongchun/chromium_src/pulls/2362 fix select crash Signed-off-by: zourongchun --- ohos_nweb/src/nweb_inputmethod_handler.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ohos_nweb/src/nweb_inputmethod_handler.cc b/ohos_nweb/src/nweb_inputmethod_handler.cc index 780defce42..18d3683f12 100644 --- a/ohos_nweb/src/nweb_inputmethod_handler.cc +++ b/ohos_nweb/src/nweb_inputmethod_handler.cc @@ -25,6 +25,7 @@ #include "base/functional/callback_helpers.h" #include "base/logging.h" #include "base/ohos/sys_info_utils.h" +#include "base/strings/utf_string_conversion_utils.h" #include "cef/include/cef_task.h" #include "content/public/browser/browser_thread.h" #include "libcef/browser/thread_util.h" @@ -1335,8 +1336,8 @@ void NWebInputMethodHandler::AutoFillWithIMFEventOnUI( #if defined(OHOS_CLIPBOARD) std::string NWebInputMethodHandler::GetSelectInfo() { - std::wstring_convert, char16_t> converter; - return converter.to_bytes(selected_text_); + std::string selected_str = base::UTF16ToUTF8(selected_text_); + return selected_str; } #endif -- Gitee