=== modified file 'termkey.c' --- termkey.c 2008-02-10 18:12:19 +0000 +++ termkey.c 2008-02-10 17:46:48 +0000 @@ -301,9 +301,8 @@ // This is easier done backwards int b = nbytes; - while(b > 1) { - b--; - key->utf8[b] = 0x80 | (codepoint & 0x3f); + while(b-- > 0) { + key->utf8[b] = codepoint & 0x3f; codepoint >>= 6; }