From 516a1766a59b4abec389e8ed4eadf666701f356e Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Sun, 10 Feb 2008 18:12:19 +0000 Subject: Bugfix to fill_utf8() to make it actually work right --- termkey.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/termkey.c b/termkey.c index f0f9d1a..3a80896 100644 --- a/termkey.c +++ b/termkey.c @@ -301,8 +301,9 @@ static void fill_utf8(termkey_key *key) // This is easier done backwards int b = nbytes; - while(b-- > 0) { - key->utf8[b] = codepoint & 0x3f; + while(b > 1) { + b--; + key->utf8[b] = 0x80 | (codepoint & 0x3f); codepoint >>= 6; } -- cgit v1.2.3-70-g09d2