SDL/src
Sam Lantinga 4dab32a2bc Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead
Jonas Kulla

src/main/windows/SDL_windows_main.c:137:
cmdline = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)(text), (SDL_wcslen(text)+1)*sizeof(WCHAR));

I'm trying to compile an SDL2 application for windows using the mingw-w64 32bit toolchain provided by my distro (Fedora 19). However, even the simplest test program that does nothing at all fails to startup with a "Fatal error - out of memory" message because the mingw iconv library provided by my distro does not support the "UCS-2-INTERNAL" encoding and the conversion returns null.

From my little bit of research, it turns out that even though this encoding is supported by the external GNU libiconv library, some glibc versions (?) don't support it with their internal iconv routines, and will instead provide the native endian encoding when "UCS-2" is specified.

Nonetheless, I wonder why the native endianness is considered in the first place when Windows doesn't even run on any big endian archs (to my knowledge). And true enough, 'WIN_StringToUTF8' from core/windows/SDL_windows.h is used everywhere else in the windows backend, which is just a macro to iconv with "UTF-16LE" as source. Therefore it would IMO make sense to use this macro here as well, which would solve my problem (patch attached).
2014-11-28 04:51:33 -08:00
..
atomic Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
audio Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
core WinRT: added initial SDL_TEXTINPUT support 2014-11-26 21:34:15 -05:00
cpuinfo Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
dynapi Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
events Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
file Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
filesystem WinRT: added SDL_HINT_WINRT_PREF_PATH_ROOT 2014-11-27 09:55:34 -05:00
haptic Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
joystick Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
libm Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
loadso Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
main Fixed bug 2786 - "UCS-2-INTERNAL" iconv encoding is not supported everywhere, use UTF-16LE instead 2014-11-28 04:51:33 -08:00
power Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
render Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
stdlib Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
test Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
thread Fixed bug 2411 - Even if built with --enable-clock_gettime, SDL2 still calls gettimeofday() 2014-11-28 04:37:50 -08:00
timer Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
video Fixed bug 2676 - xdnd_version check issue in case ClientMessage 2014-11-28 04:42:46 -08:00
SDL_assert_c.h Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL_assert.c Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL_error_c.h Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL_error.c Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL_hints.c Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL_internal.h Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL_log.c Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00
SDL.c Corrected header file documentation comment. 2014-11-22 22:20:40 +01:00