Mercurial > sdl-ios-xcode
annotate README.SVN @ 3539:f2846bf19360
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
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 11 Dec 2009 08:03:43 +0000 |
parents | c9d71d0f987d |
children |
rev | line source |
---|---|
1652
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1 |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
2 The latest development version of SDL is available via Subversion. |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
3 Subversion allows you to get up-to-the-minute fixes and enhancements; |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 as a developer works on a source tree, you can use svn to mirror that |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 source tree instead of waiting for an official release. Please look |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 at the Subversion website ( http://subversion.tigris.org/ ) for more |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 information on using svn, where you can also download software for |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 MacOS, Windows, and Unix systems. |
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
2166
711bea885c1e
Updated SVN checkout instructions
Sam Lantinga <slouken@libsdl.org>
parents:
1759
diff
changeset
|
10 svn checkout http://svn.libsdl.org/trunk/SDL |
1652
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
11 |
1759
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
12 If you are building SDL with an IDE, you will need to copy the file |
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
13 include/SDL_config.h.default to include/SDL_config.h before building. |
1652
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
14 |
1759
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
15 If you are building SDL via configure, you will need to run autogen.sh |
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
16 before running configure. |
1652
dc219ba4cf45
Info on Subversion repository access.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
17 |
1759
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
18 There is a web interface to the subversion repository at: |
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
19 http://www.libsdl.org/cgi/viewvc.cgi |
724cca1bda2d
Added instructions for copying SDL_config.h
Sam Lantinga <slouken@libsdl.org>
parents:
1652
diff
changeset
|
20 |
2708
c9d71d0f987d
Testing Subversion commit RSS feed.
Ryan C. Gordon <icculus@icculus.org>
parents:
2166
diff
changeset
|
21 There is an RSS feed available at that URL, for those that want to |
c9d71d0f987d
Testing Subversion commit RSS feed.
Ryan C. Gordon <icculus@icculus.org>
parents:
2166
diff
changeset
|
22 track commits in real time. |
c9d71d0f987d
Testing Subversion commit RSS feed.
Ryan C. Gordon <icculus@icculus.org>
parents:
2166
diff
changeset
|
23 |