From 4956882dcaddaaf607f172e198f389a448c2f99e Mon Sep 17 00:00:00 2001 From: liu-jin-yi <45869971+liu-jin-yi@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:56:29 +0800 Subject: [PATCH] fix: compatible with Chinese paths (#2) --- lib/src/string.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/string.cpp b/lib/src/string.cpp index 1ce7081..abbadf0 100644 --- a/lib/src/string.cpp +++ b/lib/src/string.cpp @@ -13,10 +13,10 @@ std::wstring stringToWString(const std::string& s) { int length; int slength = (int)s.length() + 1; - length = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0); + length = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), slength, 0, 0); std::wstring buf; buf.resize(length); - MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, const_cast(buf.c_str()), length); + MultiByteToWideChar(CP_UTF8, 0, s.c_str(), slength, const_cast(buf.c_str()), length); return buf; }