Sam Lantinga
0fd267a750
Fixed bug #896
...
John Popplewell 2009-12-08 23:05:50 PST
Originally reported by AKFoerster on the mailing list.
Error decoding UTF8 Russian text to UTF-16LE on Windows, but specifically on
platforms without iconv support (the default on Windows).
Valid UTF8 characters are flagged as being overlong and then substituted by the
UNKNOWN_UNICODE character.
After studying the testiconv.c example program, reading the RFCs and putting
some printf statements in SDL_iconv.c the problem is in a test for 'Maximum
overlong sequences', specifically 4.2.1, which is carried out by the following
code:
} else if ( p[0] >= 0xC0 ) {
if ( (p[0] & 0xE0) != 0xC0 ) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
ch = UNKNOWN_UNICODE;
} else {
if ( (p[0] & 0xCE) == 0xC0 ) { <<<<<<<< here
overlong = SDL_TRUE;
}
ch = (Uint32)(p[0] & 0x1F);
left = 1;
}
} else {
Here is the 2-byte encoding of a character in range 00000080 - 000007FF
110xxxxx 10xxxxxx
The line in question is supposed to be checking for an overlong sequence which
would be less than
11000001 10111111
which should be represented as a single byte.
BUT, the mask value (0xCE) is wrong, it isn't checking the top-most bit:
11000001 value
11001110 mask (incorrect)
^
and should be (0xDE):
11000001 value
11011110 mask (correct)
making the above code:
} else if ( p[0] >= 0xC0 ) {
if ( (p[0] & 0xE0) != 0xC0 ) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
ch = UNKNOWN_UNICODE;
} else {
if ( (p[0] & 0xDE) == 0xC0 ) { <<<<<<<< here
overlong = SDL_TRUE;
}
ch = (Uint32)(p[0] & 0x1F);
left = 1;
}
} else {
I can supply a test program and/or a patch if required,
best regards,
John Popplewell
--HG--
branch : SDL-1.2
2009-12-11 08:00:57 +00:00
Sam Lantinga
6ae6dbc492
Fixed bug #797
...
Ryan C. Gordon 2009-09-19 08:25:21 PDT
This line in SDL_iconv_string (src/stdlib/SDL_iconv.c) ...
if (!fromcode || !*fromcode) {
tocode = "UTF-8";
}
Is probably supposed to assign to "fromcode" and not "tocode".
--HG--
branch : SDL-1.2
2009-09-26 10:37:28 +00:00
Ryan C. Gordon
28958731eb
Fixed compiler warnings on Mac OS X 10.6 SDK.
...
--HG--
branch : SDL-1.2
2009-09-12 13:15:27 +00:00
Sam Lantinga
2bdc5af575
Updated copyright date
...
--HG--
branch : SDL-1.2
2008-12-08 00:25:42 +00:00
Sam Lantinga
d2f64a14b9
Fixed bug #428
...
This fix is overkill, but approved by Doug Lea, and he'll be releasing a
new version of his malloc.c sometime next month.
--HG--
branch : SDL-1.2
2007-07-16 00:07:02 +00:00
Ryan C. Gordon
6d23d090bb
Reverted r3255:3256. Don't actually need it unless the build is broken. :)
...
--HG--
branch : SDL-1.2
2007-07-14 07:06:46 +00:00
Ryan C. Gordon
2cb1d6e0b8
Mac OS X thinks we want a function call to SDL_memcpy() and not memcpy() here,
...
thanks to macro replacement issues.
--HG--
branch : SDL-1.2
2007-07-14 06:45:01 +00:00
Sam Lantinga
b8389ee714
Ryan's fix is still good for the built-in version of iconv_open()
...
--HG--
branch : SDL-1.2
2007-07-12 08:04:10 +00:00
Sam Lantinga
0d5dbe63e0
Fixed iconv handling on Solaris 11
...
--HG--
branch : SDL-1.2
2007-07-12 07:47:29 +00:00
Sam Lantinga
b314a8768e
Fixed bug #455
...
If passed "" for the character set, let iconv_open() interpret it as
locale.
--HG--
branch : SDL-1.2
2007-07-12 07:29:19 +00:00
Sam Lantinga
64f823384c
Fixed bug #447
...
Xlib uses the native locale, not latin1
... the question is... what does the server use? :)
--HG--
branch : SDL-1.2
2007-07-04 07:54:06 +00:00
Sam Lantinga
b9b6dfe97a
Fixed bug #349
...
Solaris doesn't support the LATIN1 character set alias.
--HG--
branch : SDL-1.2
2007-07-04 04:27:47 +00:00
Sam Lantinga
ede76d3d09
iconv() doesn't write to the data, just make compilers happy
...
--HG--
branch : SDL-1.2
2007-06-28 08:33:59 +00:00
Sam Lantinga
0a4a20138d
Whoops, need to actually copy inbuf
...
--HG--
branch : SDL-1.2
2007-06-28 06:53:09 +00:00
Sam Lantinga
1d39695864
Okay, apparently the newer standard specifies char** for the inbuf
...
parameter to iconv()
(See http://lists.debian.org/debian-glibc/2004/05/msg00006.html )
I'm casting in the general case, but I added a non-const codepath in
case it matters on some platform.
--HG--
branch : SDL-1.2
2007-06-28 06:47:35 +00:00
Sam Lantinga
77b434c3a5
Better fix for bug 419
...
--HG--
branch : SDL-1.2
2007-06-28 05:35:50 +00:00
Ryan C. Gordon
c66b807d4e
Added S60 port.
...
--HG--
branch : SDL-1.2
2007-06-24 18:26:35 +00:00
Ryan C. Gordon
09d57b679e
C fallback for SDL_revcpy() was off by one. Thanks to Emmanuel Jeandel for
...
the catch.
Fixes Bugzilla #424 .
--HG--
branch : SDL-1.2
2007-06-04 11:43:47 +00:00
Ryan C. Gordon
c51512e418
Minor const correctness patch to SDL_iconv.
...
--HG--
branch : SDL-1.2
2007-02-16 03:50:42 +00:00
Ryan C. Gordon
3fccbec353
Force chars to unsigned chars in SDL_string.c, so platforms that expect
...
these to not be negative, when not EOF, work.
Fixes Bugzilla #338 .
--HG--
branch : SDL-1.2
2007-02-15 11:06:22 +00:00
Sam Lantinga
9a48decd81
Fixed bug #251
2006-06-20 05:55:23 +00:00
Sam Lantinga
b03120aa73
Fixed uninitialized variable warnings
2006-05-17 15:08:46 +00:00
Sam Lantinga
5400b91864
Fixed some bugs in string handling
...
Cleaned up error message code, UTF-8 is used instead of UCS2
Added detection for MPEG Layer 3 audio for more informative errors.
2006-05-11 21:03:23 +00:00
Sam Lantinga
e1ae9a0b81
Fixed bug #175
...
Removed obsolete .cvsignore files... whee!
2006-03-23 21:39:58 +00:00
Sam Lantinga
b6313a8a66
RFC 3629 restricted the range of characters encoded with UTF-8 to 0000-10FFFF (the UTF-16 accessible range)
2006-03-13 17:25:44 +00:00
Sam Lantinga
2650f98d04
*** empty log message ***
2006-03-13 02:26:47 +00:00
Sam Lantinga
3227f8dde8
Added _strnicmp support
2006-03-13 02:12:39 +00:00
Sam Lantinga
2b03f1c722
Win32 fixes
2006-03-13 02:06:33 +00:00
Sam Lantinga
80b5071de2
props yo
2006-03-13 01:17:22 +00:00
Sam Lantinga
992d5b4402
UTF-32 by definition can't handle characters higher than 0x10FFFF
2006-03-13 01:16:16 +00:00
Sam Lantinga
48c546dc44
Added UTF-8 <-> UTF-16 <-> UTF-32 <-> UCS-2 <-> UCS-4 conversion capability
2006-03-13 01:08:00 +00:00
Sam Lantinga
e007ca640c
Fixed more Win64 portability issues
2006-03-06 08:11:10 +00:00
Sam Lantinga
223544e90d
Updated WinCE support by Dmitry (with some tweaks)
...
Converted the disk audio driver to SDL_RWops for portability
2006-03-04 08:24:35 +00:00
Sam Lantinga
62c5e3a5d5
Fixed a bunch of 64-bit compatibility problems
2006-03-01 09:43:47 +00:00
Sam Lantinga
2861771aa5
SDL_windows.h is no longer necessary
2006-02-25 22:18:25 +00:00
Sam Lantinga
190b425364
Use consistent identifiers for the various platforms we support.
...
Make sure every source file includes SDL_config.h, so the proper system
headers are chosen.
2006-02-21 08:46:50 +00:00
Sam Lantinga
0ef73d9eae
Use only safe string functions
2006-02-19 23:46:34 +00:00
Sam Lantinga
f05187e232
New configure-based build system. Still work in progress, but much improved
2006-02-16 10:11:48 +00:00
Sam Lantinga
769424426d
More header massaging... works great on Windows. ;-)
2006-02-10 06:48:43 +00:00
Sam Lantinga
20c4849e7e
Fixed build problem with SDL_string.c
...
Officially deprecated SDL_byteorder.h, SDL_getenv.h and SDL_types.h
Moved endian-related SDL_rwops code into SDL_rwops.c
2006-02-09 09:38:05 +00:00
Sam Lantinga
05f9cca4a3
Default to build SDL without MSVCRT
2006-02-08 08:55:33 +00:00
Sam Lantinga
b0e5472b68
Fixes for Visual C++ 6.0
2006-02-07 18:36:54 +00:00
Sam Lantinga
e28c454fca
*** empty log message ***
2006-02-07 17:46:19 +00:00
Sam Lantinga
d72a9898ed
Configure dynamically generates SDL_config.h
...
I'm still wrestling with autoheader, but this should work for now...
Fixed lots of build problems with C library support disabled
2006-02-07 12:11:33 +00:00
Sam Lantinga
1e037cc218
Removed uses of stdlib.h and string.h
2006-02-07 09:29:18 +00:00
Sam Lantinga
c7319385b8
Don't touch code that we brought in from other sources
2006-02-07 07:03:29 +00:00
Sam Lantinga
02cc6c0f11
Use SDL_ prefixed versions of C library functions.
...
FIXME:
Change #include <stdlib.h> to #include "SDL_stdlib.h"
Change #include <string.h> to #include "SDL_string.h"
Make sure nothing else broke because of this...
2006-02-07 06:59:48 +00:00
Sam Lantinga
dc67631a8a
*** empty log message ***
2006-02-06 08:58:44 +00:00
Sam Lantinga
f62242e296
A few fixes to get this building on Linux again
2006-02-06 08:46:14 +00:00
Sam Lantinga
82bfaee73a
It's now possible to build SDL without any C runtime at all on Windows,
...
using Visual C++ 2005
2006-02-06 08:28:51 +00:00