aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-08-14 20:47:04 +0200
committerFilippos Karapetis2019-08-24 18:12:45 +0300
commit41d3a70c5848267916d01c26b99b4b2991ae1d0e (patch)
tree20604765986ddac43ba41258035df8b4719ed392 /backends/platform
parent5fcd14fbea7b77b9bd91b5324fd377478910f873 (diff)
downloadscummvm-rg350-41d3a70c5848267916d01c26b99b4b2991ae1d0e.tar.gz
scummvm-rg350-41d3a70c5848267916d01c26b99b4b2991ae1d0e.tar.bz2
scummvm-rg350-41d3a70c5848267916d01c26b99b4b2991ae1d0e.zip
SDL: Fix convertEncoding for multibyte encodings.
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/sdl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 105a232b77..0139bac29d 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -771,7 +771,12 @@ int SDL_SetColorKey_replacement(SDL_Surface *surface, Uint32 flag, Uint32 key) {
char *OSystem_SDL::convertEncoding(const char *to, const char *from, const char *string, size_t length) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
debug("Trying SDL...");
- return SDL_iconv_string(to, from, string, length + 1);
+ int zeroBytes = 1;
+ if (Common::String(from).hasPrefixIgnoreCase("utf-16"))
+ zeroBytes = 2;
+ if (Common::String(from).hasPrefixIgnoreCase("utf-32"))
+ zeroBytes = 4;
+ return SDL_iconv_string(to, from, string, length + zeroBytes);
#else
debug("SDL isn't available");
return nullptr;