INSTALL.txt
author Sam Lantinga <slouken@libsdl.org>
Fri, 28 Nov 2014 04:51:33 -0800
changeset 9246 a761913e5e91
parent 9025 d09d4b578e77
child 10893 54480745c410
permissions -rw-r--r--
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).
     1 
     2 To compile and install SDL:
     3 
     4     1.  Windows with Visual Studio:
     5         * Read VisualC.html
     6 
     7         Windows with gcc, either native or cross-compiling:
     8         * Read the FAQ at http://wiki.libsdl.org/moin.fcg/FAQWindows
     9         * Run './configure; make; make install'
    10 
    11         Mac OS X with Xcode:
    12         * Read docs/README-macosx.md
    13 
    14         Mac OS X from the command line:
    15         * Run './configure; make; make install'
    16 
    17         Linux and other UNIX systems:
    18         * Run './configure; make; make install'
    19 
    20         Android:
    21         * Read docs/README-android.md
    22 
    23         iOS:
    24         * Read docs/README-ios.md
    25 
    26         Using Cmake:
    27         * Read docs/README-cmake.md
    28 
    29     2.  Look at the example programs in ./test, and check out the online
    30         documentation at http://wiki.libsdl.org/
    31 
    32     3.  Join the SDL developer mailing list by sending E-mail to
    33     	sdl-request@libsdl.org
    34         and put "subscribe" in the subject of the message.
    35 
    36         Or alternatively you can use the web interface:
    37             http://www.libsdl.org/mailing-list.php
    38 
    39 That's it!
    40 Sam Lantinga <slouken@libsdl.org>