# HG changeset patch # User Sam Lantinga # Date 1142212576 0 # Node ID d403a39389da46f65b0ececdf8f9e67483a13172 # Parent 73dc5d39bbf8adda2a7ffafd848bda24348ee9ba UTF-32 by definition can't handle characters higher than 0x10FFFF diff -r 73dc5d39bbf8 -r d403a39389da src/stdlib/SDL_iconv.c --- a/src/stdlib/SDL_iconv.c Mon Mar 13 01:08:00 2006 +0000 +++ b/src/stdlib/SDL_iconv.c Mon Mar 13 01:16:16 2006 +0000 @@ -669,7 +669,7 @@ case ENCODING_UTF32BE: { Uint8 *p = (Uint8 *)dst; - if ( ch > 0x7FFFFFFF ) { + if ( ch > 0x10FFFF ) { ch = UNKNOWN_UNICODE; } if ( dstlen < 4 ) { @@ -686,7 +686,7 @@ case ENCODING_UTF32LE: { Uint8 *p = (Uint8 *)dst; - if ( ch > 0x7FFFFFFF ) { + if ( ch > 0x10FFFF ) { ch = UNKNOWN_UNICODE; } if ( dstlen < 4 ) { diff -r 73dc5d39bbf8 -r d403a39389da test/testiconv.c --- a/test/testiconv.c Mon Mar 13 01:08:00 2006 +0000 +++ b/test/testiconv.c Mon Mar 13 01:16:16 2006 +0000 @@ -3,7 +3,7 @@ #include "SDL.h" -static SDL_bool testutf16(char *data) +static SDL_bool testutf1632(char *data) { Uint32 *p = (Uint32 *)data; while(*p) { @@ -63,8 +63,10 @@ size_t len = (widelen(ucs4)+1)*4; for ( i = 0; i < SDL_arraysize(formats); ++i ) { if ( (SDL_strncasecmp(formats[i], "UTF16", 5) == 0 || - SDL_strncasecmp(formats[i], "UTF-16", 6) == 0) && - !testutf16(ucs4) ) { + SDL_strncasecmp(formats[i], "UTF-16", 6) == 0 || + SDL_strncasecmp(formats[i], "UTF32", 5) == 0 || + SDL_strncasecmp(formats[i], "UTF-32", 6) == 0) && + !testutf1632(ucs4) ) { continue; } test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len);