Skip to content

Commit d779c74

Browse files
committed
instead of just getting Latin1 we practically see getting 2 or 3 bytes (even for characters that representable in Latin1) so try our best to interpret them
1 parent e03ddf7 commit d779c74

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Source/x11/XIMInputServer.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,18 @@ - (NSString *) lookupStringForEvent: (XKeyEvent *)event
151151
{
152152
/* Always returns a Latin-1 string according to the manpage */
153153
count = XLookupString (event, buf, BUF_LEN, &keysym, NULL);
154-
if (count)
154+
if (count == 1)
155155
{
156156
keys = [[[NSString alloc] initWithBytes: buf
157157
length: count
158158
encoding: NSISOLatin1StringEncoding] autorelease];
159159
}
160+
else if (count > 1) // manpage lies and we suppose UTF-8
161+
{
162+
keys = [[[NSString alloc] initWithBytes: buf
163+
length: count
164+
encoding: NSUTF8StringEncoding] autorelease];
165+
}
160166

161167
if (keysymptr)
162168
*keysymptr = keysym;

0 commit comments

Comments
 (0)