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:
parent
35386aab4c
commit
f0ad817716
1 changed files with 3 additions and 12 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue