diff options
Diffstat (limited to 'backends/platform/sdl/sdl.cpp')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 7 |
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; |