The culprits are the signed char values of octets (8 bit
characters) and the wide character functions, eg. iswupper().

  The value of the capital letter "Ö" (O with diaeresis, 0xD6) from
a signed char variable is 4,294,967,254 in a wchar_t (unsigned int)
variable.  The function iswupper() with this value says it is not
an upper case character!

  The code in "cvt.c", lines 97-

/* Just copy the char to the destination buffer. */
if ((ops & CVT_TO_LC) && IS_UPPER(ch))
  ch = TO_LOWER(ch);
put_wchar(&dst, ch);

  is transformed to

if ((ops & 01) && iswupper(ch))
  ch = towlower(ch)
put_wchar(&dst,ch)

  The value of "ops" was 7 in my tests.

  The function "towlower() is never(?) executed, because
iswupper(ch) returns zero for (some, all?) octets in the form of a
signed character value.

  This means

1) All programs that deal with wide characters (eg. UTF-8) must be
compiled with "char" = "unsigned char".

2) The "signed char" type is obsolete.

3) The C-standard should be revised, having only one "char"
variable type, interpreted as a nonnegative integer value (or the
same as "unsigned char" is now).



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to