src/stdlib/SDL_iconv.c
branchSDL-1.2
changeset 4054 64bf737873a2
parent 4053 0aadbc81c497
child 4055 6ed1fded55ff
equal deleted inserted replaced
4053:0aadbc81c497 4054:64bf737873a2
   805 	size_t outbytesleft;
   805 	size_t outbytesleft;
   806 	size_t retCode = 0;
   806 	size_t retCode = 0;
   807 
   807 
   808 	cd = SDL_iconv_open(tocode, fromcode);
   808 	cd = SDL_iconv_open(tocode, fromcode);
   809 	if ( cd == (SDL_iconv_t)-1 ) {
   809 	if ( cd == (SDL_iconv_t)-1 ) {
       
   810 		/* See if we can recover here (fixes iconv on Solaris 11) */
       
   811 		if ( !tocode || !*tocode ) {
       
   812 			tocode = "UTF-8";
       
   813 		}
       
   814 		if ( !fromcode || !*fromcode ) {
       
   815 			tocode = "UTF-8";
       
   816 		}
       
   817 		cd = SDL_iconv_open(tocode, fromcode);
       
   818 	}
       
   819 	if ( cd == (SDL_iconv_t)-1 ) {
   810 		return NULL;
   820 		return NULL;
   811 	}
   821 	}
   812 
   822 
   813 	stringsize = inbytesleft > 4 ? inbytesleft : 4;
   823 	stringsize = inbytesleft > 4 ? inbytesleft : 4;
   814 	string = SDL_malloc(stringsize);
   824 	string = SDL_malloc(stringsize);