diff --git a/Common/Data/Encoding/Utf8.cpp b/Common/Data/Encoding/Utf8.cpp index 760fe6b07d..12e6914882 100644 --- a/Common/Data/Encoding/Utf8.cpp +++ b/Common/Data/Encoding/Utf8.cpp @@ -558,6 +558,12 @@ std::u16string ConvertUTF8ToUCS2(const std::string &source) { return dst; } +std::string CodepointToUTF8(uint32_t codePoint) { + char temp[16]{}; + UTF8::encode(temp, codePoint); + return std::string(temp); +} + #ifndef _WIN32 // Replacements for the Win32 wstring functions. Not to be used from emulation code! diff --git a/Common/Data/Encoding/Utf8.h b/Common/Data/Encoding/Utf8.h index 29d09f67e9..492339a980 100644 --- a/Common/Data/Encoding/Utf8.h +++ b/Common/Data/Encoding/Utf8.h @@ -89,6 +89,8 @@ bool UTF8StringHasNonASCII(const char *utf8string); // Removes overlong encodings and similar. std::string SanitizeUTF8(const std::string &utf8string); +std::string CodepointToUTF8(uint32_t codePoint); + // UTF8 to Win32 UTF-16 // Should be used when calling Win32 api calls diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 2a9541f4fd..00e0a7e0bb 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -39,6 +39,7 @@ #endif #include "Common/File/AndroidStorage.h" #include "Common/Data/Text/I18n.h" +#include "Common/Data/Encoding/Utf8.h" #include "Common/Net/HTTPClient.h" #include "Common/UI/Context.h" #include "Common/UI/View.h" @@ -834,7 +835,8 @@ void SystemInfoScreen::CreateTabs() { internals->Add(new ItemHeader(si->T("Notification tests"))); internals->Add(new Choice(si->T("Error")))->OnClick.Add([&](UI::EventParams &) { - g_OSD.Show(OSDType::MESSAGE_ERROR, "Error"); + std::string str = "Error " + CodepointToUTF8(0x1F41B) + CodepointToUTF8(0x1FAB0) + CodepointToUTF8(0x1F41C) + CodepointToUTF8(0x1FAB2); + g_OSD.Show(OSDType::MESSAGE_ERROR, str); return UI::EVENT_DONE; }); internals->Add(new Choice(si->T("Warning")))->OnClick.Add([&](UI::EventParams &) { diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 0f928332e2..b262d63325 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -34,6 +34,7 @@ #include "Common/File/VFS/VFS.h" #include "Common/Data/Color/RGBAUtil.h" +#include "Common/Data/Encoding/Utf8.h" #include "Common/Data/Text/I18n.h" #include "Common/Data/Random/Rng.h" #include "Common/TimeUtil.h" @@ -798,7 +799,9 @@ void LogoScreen::render() { // Draw the graphics API, except on UWP where it's always D3D11 std::string apiName = screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME); #ifdef _DEBUG - apiName += ", debug build"; + apiName += ", debug build "; + // Add some bug emoji for testing. + apiName += CodepointToUTF8(0x1F41B) + CodepointToUTF8(0x1FAB0) + CodepointToUTF8(0x1F41C) + CodepointToUTF8(0x1FAB2); #endif dc.DrawText(gr->T(apiName), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER); #endif