Skip to content

Commit 82d8faf

Browse files
committed
get unicode text for clipboard on windows
1 parent 5c3afbd commit 82d8faf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

loader/src/platform/windows/util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ bool utils::clipboard::write(std::string const& data) {
5454
std::string utils::clipboard::read() {
5555
if (!OpenClipboard(nullptr)) return "";
5656

57-
HANDLE hData = GetClipboardData(CF_TEXT);
57+
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
5858
if (hData == nullptr) {
5959
CloseClipboard();
6060
return "";
6161
}
6262

63-
char* pszText = static_cast<char*>(GlobalLock(hData));
63+
auto pszText = static_cast<wchar_t*>(GlobalLock(hData));
6464
if (pszText == nullptr) {
6565
CloseClipboard();
6666
return "";
6767
}
6868

69-
std::string text(pszText);
69+
std::string text = string::wideToUtf8(pszText);
7070

7171
GlobalUnlock(hData);
7272
CloseClipboard();

0 commit comments

Comments
 (0)