Skip to content

Commit

Permalink
instead of just getting Latin1 we practically see getting 2 or 3 byte…
Browse files Browse the repository at this point in the history
…s (even for characters that representable in Latin1) so try our best to interpret them (#50)
  • Loading branch information
rmottola authored Sep 19, 2024
1 parent ba1c582 commit 4e3ca27
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/x11/XIMInputServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e3ca27

Please sign in to comment.