From f0ad817716c55906583ff917737c58dfd13f15e0 Mon Sep 17 00:00:00 2001 From: aryanrawlani28 Date: Tue, 18 Aug 2020 18:24:57 +0530 Subject: [PATCH] SDL: Fix clipboard fetching internally - This doesn't mean that it displays properly in the GUI, but it does return the proper value from getTextFromClipboard. --- backends/platform/sdl/sdl.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 2fe96929865..fc3785832e3 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -499,18 +499,9 @@ Common::U32String OSystem_SDL::getTextFromClipboard() { if (!hasTextInClipboard()) return Common::U32String(""); char *text = SDL_GetClipboardText(); - // The string returned by SDL is in UTF-8. Convert to the - // current TranslationManager encoding or ISO-8859-1. -#ifdef USE_TRANSLATION - char *conv_text = SDL_iconv_string(TransMan.getCurrentCharset().c_str(), "UTF-8", text, SDL_strlen(text) + 1); -#else - char *conv_text = SDL_iconv_string("ISO-8859-1", "UTF-8", text, SDL_strlen(text) + 1); -#endif - if (conv_text) { - SDL_free(text); - text = conv_text; - } - Common::U32String strText(text); + + Common::String utf8Text(text); + Common::U32String strText = utf8Text.decode(); SDL_free(text); return strText;