• Sam Lantinga's avatar
    Fixed bug: SDL_ttf incorrectly identifies some utf8 characters as "overlong". · 10f3662a
    Sam Lantinga authored
    Tommy
    
    I noticed that the UTF8_getch() function in SDL_ttf.c is incorrectly identifying some valid UTF-8 characters as "overlong".
    
    The particular character that brought this to my attention was '??' (0x1033a), with the four-byte UTF-8 representation 0xF0908CBA.
    
    The problem is that it only checks if the first byte has no high bits, not if the first 5 meaningful bits are 0. In the extreme 6-byte case, there is only one meaningful bit in the first byte. So fully half of all theoretically valid 6-byte characters are incorrectly identified as overlong.
    10f3662a
Name
Last commit
Last update
VisualC Loading commit data...
Xcode Loading commit data...
Xcode-iOS/SDL_ttf.xcodeproj Loading commit data...
acinclude Loading commit data...
debian Loading commit data...
external/freetype-2.4.12 Loading commit data...
.hgignore Loading commit data...
Android.mk Loading commit data...
CHANGES.txt Loading commit data...
COPYING.txt Loading commit data...
Makefile.am Loading commit data...
Makefile.in Loading commit data...
README.txt Loading commit data...
SDL2_ttf.pc.in Loading commit data...
SDL2_ttf.spec Loading commit data...
SDL2_ttf.spec.in Loading commit data...
SDL_ttf.c Loading commit data...
SDL_ttf.h Loading commit data...
aclocal.m4 Loading commit data...
autogen.sh Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
depcomp Loading commit data...
gcc-fat.sh Loading commit data...
glfont.c Loading commit data...
install-sh Loading commit data...
ltmain.sh Loading commit data...
missing Loading commit data...
showfont.c Loading commit data...
version.rc Loading commit data...