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.
This commit is contained in:
aryanrawlani28 2020-08-18 18:24:57 +05:30 committed by Eugene Sandulenko
parent 35386aab4c
commit f0ad817716

View file

@ -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;