diff --git a/Source/x11/XIMInputServer.m b/Source/x11/XIMInputServer.m index 690d807f..77bc594c 100644 --- a/Source/x11/XIMInputServer.m +++ b/Source/x11/XIMInputServer.m @@ -151,12 +151,18 @@ - (NSString *) lookupStringForEvent: (XKeyEvent *)event { /* Always returns a Latin-1 string according to the manpage */ count = XLookupString (event, buf, BUF_LEN, &keysym, NULL); - if (count) + if (count == 1) { keys = [[[NSString alloc] initWithBytes: buf length: count encoding: NSISOLatin1StringEncoding] autorelease]; } + else if (count > 1) // manpage lies and we suppose UTF-8 + { + keys = [[[NSString alloc] initWithBytes: buf + length: count + encoding: NSUTF8StringEncoding] autorelease]; + } if (keysymptr) *keysymptr = keysym;