diff -r 6113ed66d258 -r bcacd00ea955 ui/winui/util.cpp --- a/ui/winui/util.cpp Sun Oct 01 17:22:17 2023 +0200 +++ b/ui/winui/util.cpp Sun Oct 01 18:54:23 2023 +0200 @@ -26,4 +26,20 @@ wstr[wlen] = 0; return wstr; -} \ No newline at end of file +} + +char* wchar2utf8(const wchar_t* wstr, size_t wlen) { + size_t maxlen = wlen * 4; + char* ret = (char*)malloc(maxlen + 1); + int ret_len = WideCharToMultiByte( + CP_UTF8, + 0, + wstr, + wlen, + ret, + maxlen, + NULL, + NULL); + ret[ret_len] = 0; + return ret; +}