From d235885d70dd5fd1526c1bcda215a654d776399b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 27 Jun 2021 13:47:50 +0800 Subject: [PATCH] Fix truncated string conversion --- .../world_editor/world_editor/world_editor.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp b/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp index ee47f6afb..485fd3668 100644 --- a/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp +++ b/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp @@ -823,21 +823,18 @@ void setEditTextMultiLine (CListBox &listBox, const std::vector &ve bool setWindowTextUTF8 (HWND hwnd, const std::string &textUtf8) { - ucstring str; - - str.fromUtf8 (textUtf8); - return SetWindowTextW (hwnd, (WCHAR*)str.c_str()) != FALSE; + return SetWindowTextW(hwnd, nlUtf8ToWide(textUtf8)) != FALSE; } // *************************************************************************** bool getWindowTextUTF8 (HWND hwnd, std::string &textUtf8) { - ucstring text; - text.resize (GetWindowTextLengthW (hwnd)); - if (GetWindowTextW (hwnd, (WCHAR*)text.c_str(), text.size())) + wstring text; + text.resize(GetWindowTextLengthW(hwnd)); + if (GetWindowTextW(hwnd, &text[0], text.size() + 1)) { - textUtf8 = text.toUtf8 ().c_str(); + textUtf8 = NLMISC::wideToUtf8(text); return true; } else