[Vm-dev] Why does setLocaleEncoding() set sqTextEncoding

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Dec 23 22:46:57 UTC 2019


Hmm,
If I look into sendSelection() I see a dependency on localeEncoding
equality:
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/6bedd6746a0173c90751c63b0d1bdc85bf3803c4/platforms/unix/vm-display-X11/sqUnixX11.c#L761

A reasonably simple scheme nowadays would be exchanging all data
(clipboard, drag and drop, ...) between image and VM thru UTF8 encoding...
Of course, it's not the most optimized encoding for eastern asian
languages, so we should better think twice, but this could remove
considerable complexity from both VM and image (Multilingual) sides.

In which case, sqTextEncoding should rather be UTF8.
BUT: sqTextEncoding should ABSOLUTELY not be used for encoding platform
event keycode (charCode).
As suggested in other thread, we could use platform independent keycodes.
The X11 ones are already duplicated in the VM
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/6bedd6746a0173c90751c63b0d1bdc85bf3803c4/platforms/unix/vm-display-X11/sqUnixX11.c#L2576

Le lun. 23 déc. 2019 à 17:33, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> a écrit :

> Hi all,
> I'm trying to gain deeper understanding of unix keyboard events.
> See
> https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/6bedd6746a0173c90751c63b0d1bdc85bf3803c4/platforms/unix/vm/sqUnixCharConv.c#L243
> I can understand that the unix side might be governed by appropriate
> locale environment variable. But why changing sqTextEncoding???
> sqTextEncoding is the encoding used at image side for a few things,
> including copy/paste buffer and keyboard event charCode (event at: 3).
> Should the image side really need to follow the locale? Does it?
> At least, for charCode that does not sound like the right thing!
> I have fr_FR.UTF-8, so I'm getting multi-byte encoding for single byte
> charCode!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20191223/ebe5c8ec/attachment-0001.html>


More information about the Vm-dev mailing list