diff --git a/src/config.cpp b/src/config.cpp index 61deef7c..fa32fb26 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -984,7 +984,7 @@ namespace config { for (auto &[name, val] : vars) { #ifdef _WIN32 - std::cout << "["sv << name << "] -- ["sv << convertUtf8ToCurrentCodepage(val) << ']' << std::endl; + std::cout << "["sv << name << "] -- ["sv << utf8ToAcp(val) << ']' << std::endl; #else std::cout << "["sv << name << "] -- ["sv << val << ']' << std::endl; #endif diff --git a/src/platform/windows/utils.cpp b/src/platform/windows/utils.cpp index 281229ce..66c043d4 100644 --- a/src/platform/windows/utils.cpp +++ b/src/platform/windows/utils.cpp @@ -19,7 +19,7 @@ std::wstring acpToUtf16(const std::string& origStr) { return utf16Str; } -std::string utf16toAcp(const std::wstring& utf16Str) { +std::string utf16ToAcp(const std::wstring& utf16Str) { auto acp = GetACP(); int codepageLen = WideCharToMultiByte(acp, 0, utf16Str.c_str(), utf16Str.size(), NULL, 0, NULL, NULL); @@ -33,7 +33,7 @@ std::string utf16toAcp(const std::wstring& utf16Str) { return codepageStr; } -std::string convertUtf8ToCurrentCodepage(const std::string& utf8Str) { +std::string utf8ToAcp(const std::string& utf8Str) { if (GetACP() == CP_UTF8) { return std::string(utf8Str); } @@ -46,10 +46,10 @@ std::string convertUtf8ToCurrentCodepage(const std::string& utf8Str) { std::wstring utf16Str(utf16Len, L'\0'); MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), utf8Str.size(), &utf16Str[0], utf16Len); - return utf16toAcp(utf16Str); + return utf16ToAcp(utf16Str); } -std::string convertCurrentCodepageToUtf8(const std::string& origStr) { +std::string acpToUtf8(const std::string& origStr) { if (GetACP() == CP_UTF8) { return std::string(origStr); } diff --git a/src/platform/windows/utils.h b/src/platform/windows/utils.h index 406c1c2e..de181aff 100644 --- a/src/platform/windows/utils.h +++ b/src/platform/windows/utils.h @@ -7,9 +7,9 @@ #include std::wstring acpToUtf16(const std::string& origStr); -std::string utf16toAcp(const std::wstring& utf16Str); -std::string convertUtf8ToCurrentCodepage(const std::string& utf8Str); -std::string convertCurrentCodepageToUtf8(const std::string& currentStr); +std::string utf16ToAcp(const std::wstring& utf16Str); +std::string utf8ToAcp(const std::string& utf8Str); +std::string acpToUtf8(const std::string& currentStr); std::string get_error_string(LONG error_code); diff --git a/src/system_tray.cpp b/src/system_tray.cpp index dd8550cd..49f1f42e 100644 --- a/src/system_tray.cpp +++ b/src/system_tray.cpp @@ -226,7 +226,7 @@ namespace system_tray { #ifdef _WIN32 std::string tmp_str = "Open Apollo (" + config::nvhttp.sunshine_name + ":" + std::to_string(net::map_port(confighttp::PORT_HTTPS)) + ")"; - static const std::string title_str = convertUtf8ToCurrentCodepage(tmp_str); + static const std::string title_str = utf8ToAcp(tmp_str); #else static const std::string title_str = "Open Apollo (" + config::nvhttp.sunshine_name + ":" + std::to_string(net::map_port(confighttp::PORT_HTTPS)) + ")"; #endif @@ -268,8 +268,8 @@ namespace system_tray { snprintf(msg, std::size(msg), "%s launched.", app_name.c_str()); snprintf(force_close_msg, std::size(force_close_msg), "Force close [%s]", app_name.c_str()); #ifdef _WIN32 - strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1); - strncpy(force_close_msg, convertUtf8ToCurrentCodepage(force_close_msg).c_str(), std::size(force_close_msg) - 1); + strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1); + strncpy(force_close_msg, utf8ToAcp(force_close_msg).c_str(), std::size(force_close_msg) - 1); #endif tray.notification_text = msg; tray.notification_icon = TRAY_ICON_PLAYING; @@ -293,7 +293,7 @@ namespace system_tray { char msg[256]; snprintf(msg, std::size(msg), "Streaming paused for %s", app_name.c_str()); #ifdef _WIN32 - strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1); + strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1); #endif tray.icon = TRAY_ICON_PAUSING; tray.notification_title = "Stream Paused"; @@ -318,7 +318,7 @@ namespace system_tray { char msg[256]; snprintf(msg, std::size(msg), "Streaming stopped for %s", app_name.c_str()); #ifdef _WIN32 - strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1); + strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1); #endif tray.icon = TRAY_ICON; tray.notification_icon = TRAY_ICON; @@ -344,7 +344,7 @@ namespace system_tray { char msg[256]; snprintf(msg, std::size(msg), "Application %s exited too fast with code %d. Click here to terminate the stream.", app_name.c_str(), exit_code); #ifdef _WIN32 - strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1); + strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1); #endif tray.icon = TRAY_ICON; tray.notification_icon = TRAY_ICON; @@ -395,7 +395,7 @@ namespace system_tray { char msg[256]; snprintf(msg, std::size(msg), "Device %s paired Succesfully. Please make sure you have access to the device.", device_name.c_str()); #ifdef _WIN32 - strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1); + strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1); #endif tray.notification_title = "Device Paired Succesfully"; tray.notification_text = msg; @@ -419,7 +419,7 @@ namespace system_tray { char msg[256]; snprintf(msg, std::size(msg), "%s has connected to the session.", client_name.c_str()); #ifdef _WIN32 - strncpy(msg, convertUtf8ToCurrentCodepage(msg).c_str(), std::size(msg) - 1); + strncpy(msg, utf8ToAcp(msg).c_str(), std::size(msg) - 1); #endif tray.notification_title = "Client Connected"; tray.notification_text = msg;