[klibc] Question about islower() in ctype.h (ANSI compat headers test)

H. Peter Anvin hpa at zytor.com
Mon Mar 7 13:36:21 PST 2005


Martin Schlemmer wrote:
> Hi,
> 
> So far with the latest changes the projects I am trying to port works
> fine, except for a mismatch on what is considered the ansi behaviour of
> islower() in ctype.h:
> 
> -----
> i = 220
> islower (i) = 0, ISLOWER (i) = 0
> toupper (i) = 220, TOUPPER (i) = 220
> i = 221
> islower (i) = 0, ISLOWER (i) = 0
> toupper (i) = 221, TOUPPER (i) = 221
> i = 222
> islower (i) = 0, ISLOWER (i) = 0
> toupper (i) = 222, TOUPPER (i) = 222
> i = 223
> islower (i) = 2, ISLOWER (i) = 0
> toupper (i) = 223, TOUPPER (i) = 223
> No Match!
> nosferatu 1.0.0.rc6.klibc4 # cat foo.c
> /* confdefs.h.  */
> 

man iso-8859-1

        337   223   DF      ??     LATIN SMALL LETTER SHARP S

UnicodeData.txt

00DF;LATIN SMALL LETTER SHARP S;Ll;0;L;;;;;N;;German;;;

(meaning: lower case, no upper case equivalent)

Your ISLOWER() is broken and only applies to ASCII, so using it in the 
range > 127 is just crap.

I chose to implement iso-8859-1 as a reasonable default for > 127, 
although one could argue that since the only thing one can rely upon is 
ASCII, I should just have stuck to it.

	-hpa



More information about the klibc mailing list