mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-22 19:31:19 +00:00
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
This commit is contained in:
parent
e03ddf7b2b
commit
d779c743c1
1 changed files with 7 additions and 1 deletions
|
@ -151,12 +151,18 @@
|
||||||
{
|
{
|
||||||
/* Always returns a Latin-1 string according to the manpage */
|
/* Always returns a Latin-1 string according to the manpage */
|
||||||
count = XLookupString (event, buf, BUF_LEN, &keysym, NULL);
|
count = XLookupString (event, buf, BUF_LEN, &keysym, NULL);
|
||||||
if (count)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
keys = [[[NSString alloc] initWithBytes: buf
|
keys = [[[NSString alloc] initWithBytes: buf
|
||||||
length: count
|
length: count
|
||||||
encoding: NSISOLatin1StringEncoding] autorelease];
|
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)
|
if (keysymptr)
|
||||||
*keysymptr = keysym;
|
*keysymptr = keysym;
|
||||||
|
|
Loading…
Reference in a new issue