gnustep / libs-back

The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification). *** Larger patches require copyright assignment to FSF. please file bugs here. ***
http://www.gnustep.org
GNU General Public License v3.0
50 stars 34 forks source link

on FreeBSD 13.3 issues with extended chars #49

Open rmottola opened 2 months ago

rmottola commented 2 months ago

Small sum up of email thread.

After FreeBSD 13.3 update, extended character typing (e.g. àè or ° and €) started not working and outputting multiple characters. It appears to be linked to these env. variables set: LANG=C.UTF-8 XMODIFIERS="@im=kinput2"

rmottola commented 2 months ago

Even without setting XMODIFIERS (when things appear to "work" for the user) I noticed that KeyPress and KeyRelease characters are different for extended characters:

2024-09-11 23:19:51.042 Ink[2352:100713] XKeyEvent keyCode 22
2024-09-11 23:19:51.042 Ink[2352:100713] unicode modifiers: 0
2024-09-11 23:19:51.042 Ink[2352:100713] unicode no modifiers: 0
2024-09-11 23:19:51.042 Ink[2352:100713] process_key_event: keys:è ukeys:è
2024-09-11 23:19:51.125 Ink[2352:100713] XKeyEvent keyCode 22
2024-09-11 23:19:51.125 Ink[2352:100713] unicode modifiers: 0
2024-09-11 23:19:51.125 Ink[2352:100713] unicode no modifiers: 0
2024-09-11 23:19:51.125 Ink[2352:100713] process_key_event: keys:è ukeys:è 

It is partially expected: On KeyPress the character conversion is done by using Xutf8LookupString and initialising NSString with NSUTF8StringEncoding, while on KeyRelease Xutf8LookupString is not available per X11 spec, then XLookupString is used and string is initialised using NSISOLatin1StringEncoding. One would expect that at least for Latin1 characters it should be equivalent, but not and the string contains "garbage".

rmottola commented 2 months ago

I found out that when the Latin1 is not interpreted correctly, count my XLookupString is > 1, it means it cannot be a single char of a key. It may be 2 long for e.g. à, but 3 for €.

I tried some smartness and if I interpret it as UTF8, all appears to work!!