From eee64b3cad88d05ed9fc46746027b0ab1715dc3b Mon Sep 17 00:00:00 2001 From: RERASER <2641320887@qq.com> Date: Fri, 20 Sep 2024 13:02:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=94=B9=E4=B8=BAutf8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/string.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/utils/string.cpp b/src/common/utils/string.cpp index 6e7850d..1702064 100644 --- a/src/common/utils/string.cpp +++ b/src/common/utils/string.cpp @@ -220,11 +220,11 @@ namespace utils::string { std::string buffer; - auto size = WideCharToMultiByte(65001, 0, str.data(), -1, nullptr, 0, nullptr, nullptr);//这里返回的大小包含null + auto size = WideCharToMultiByte(65001, 0, str.data(), -1, nullptr, 0, nullptr, nullptr);//杩欓噷杩斿洖鐨勫ぇ灏忓寘鍚玭ull size--; buffer.resize(size); - WideCharToMultiByte(65001, 0, str.data(), -1, buffer.data(), size, nullptr, nullptr);//如果显式指定大小则可以不包含null + WideCharToMultiByte(65001, 0, str.data(), -1, buffer.data(), size, nullptr, nullptr);//濡傛灉鏄惧紡鎸囧畾澶у皬鍒欏彲浠ヤ笉鍖呭惈null return buffer; }