The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_iconv_utf8_ucs2 fails on Ubuntu for me
Alexey Petruchik
Guest

Calling SDL_iconv_utf8_ucs2 fails on Ubuntu for me. It seems that it's caused by using system iconv implementation on Linux systems. SDL_iconv_utf8_ucs2 uses "UCS-2-INTERNAL" as a tocode. Running "iconv -l | grep UCS" on my Ubuntu (14.10) gives such results:

10646-1:1993/UCS4/
CSUCS4//
ISO-10646/UCS2/
ISO-10646/UCS4/
UCS-2//
UCS-2BE//
UCS-2LE//
UCS-4//
UCS-4BE//
UCS-4LE//
UCS2//
UCS4//



It seems that system iconv know nothing about "UCS-2-INTERNAL".
Changing SDL_iconv_utf8_ucs2 to:


 (Uint16*)SDL_iconv_string("UCS-2", "UTF-8", event.text.text, SDL_strlen(event.text.text) + 1);


seems to be fixing problem. But I think it's still a bug when SDL_iconv_utf8_ucs2() doesn't work on some platforms.


Regards, Alexey