aboutsummaryrefslogtreecommitdiff
path: root/termkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'termkey.c')
-rw-r--r--termkey.c5
1 files 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;
}