diff src/stdlib/SDL_iconv.c @ 4054:64bf737873a2 SDL-1.2

Fixed iconv handling on Solaris 11
author Sam Lantinga <slouken@libsdl.org>
date Thu, 12 Jul 2007 07:47:29 +0000
parents 0aadbc81c497
children 6ed1fded55ff
line wrap: on
line diff
--- 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;
 	}