From 3e4b5c7d3b75c5ff59e68c29296b57ac2b7f607d Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Wed, 14 Aug 2019 01:43:12 +0200 Subject: WIN32: Resolve endianity in convertEncoding() --- backends/platform/sdl/win32/win32.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'backends/platform/sdl/win32') diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index e1f7964ab3..d3e8c4d1d5 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -392,6 +392,16 @@ char *OSystem_Win32::convertEncoding(const char* to, const char *from, const cha if (result != nullptr) return result; + // We accept only the machine endianness +#ifdef SCUMM_BIG_ENDIAN + if (Common::String(from).hasSuffixIgnoreCase("le") || + Common::String(to).hasSuffixIgnoreCase("le")) + return nullptr; +#else + if (Common::String(from).hasSuffixIgnoreCase("be") || + Common::String(to).hasSuffixIgnoreCase("be")) + return nullptr; +#endif // UTF-32 is really important for us, because it is used for the // transliteration in Common::Encoding and Win32 cannot convert it if (Common::String(from).hasPrefixIgnoreCase("utf-32")) { -- cgit v1.2.3