[vdr-1.5.5] inc/dec character not working for ÄÖÜ in non-UTF8

Message ID 46840D32.4020604@gmx.de
State New

Commit Message

Udo Richter June 28, 2007, 7:34 p.m. UTC
  Hi Klaus,

Found a bug in VDR-1.5.5 in non-UTF8 mode. In any text field, when the 
cursor is on an uppercase non-ASCII character like ÄÖÜ, the up/down key 
jumps directly to A.

The core problem is that the non-UTF8 version of Utf8ToArray 
sign-extends chars to uints, turning the ä of the allowed chars into 
0xFFFFFFE4, while the towlower() of the edit control changes the Ä into 
0x000000E4, which is then not in the list of allowed characters. 
Lowercase works, since here everything stays sign-extended.

The attached patch changes Utf8ToArray to properly extend chars as unsigned.




--- vdr-1.5.5-orig/tools.c	2007-06-23 15:38:30.000000000 +0200
+++ vdr-1.5.5/tools.c	2007-06-28 21:10:58.000000000 +0200
@@ -685,7 +685,7 @@ 
   int n = 0;
   while (*s && --Size > 0) {
         if (cCharSetConv::SystemCharacterTable())
-           *a++ = *s++;
+           *a++ = (unsigned char)(*s++);
         else {
            int sl = Utf8CharLen(s);
            *a++ = Utf8CharGet(s, sl);