Fixed iconv handling on Solaris 11 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Thu, 12 Jul 2007 07:47:29 +0000
branchSDL-1.2
changeset 4054 64bf737873a2
parent 4053 0aadbc81c497
child 4055 6ed1fded55ff
Fixed iconv handling on Solaris 11
src/stdlib/SDL_iconv.c
--- a/src/stdlib/SDL_iconv.c	Thu Jul 12 07:29:19 2007 +0000
+++ b/src/stdlib/SDL_iconv.c	Thu Jul 12 07:47:29 2007 +0000
@@ -807,6 +807,16 @@
 
 	cd = SDL_iconv_open(tocode, fromcode);
 	if ( cd == (SDL_iconv_t)-1 ) {
+		/* See if we can recover here (fixes iconv on Solaris 11) */
+		if ( !tocode || !*tocode ) {
+			tocode = "UTF-8";
+		}
+		if ( !fromcode || !*fromcode ) {
+			tocode = "UTF-8";
+		}
+		cd = SDL_iconv_open(tocode, fromcode);
+	}
+	if ( cd == (SDL_iconv_t)-1 ) {
 		return NULL;
 	}