Michael B Allen <[EMAIL PROTECTED]>: > I am in the process of modifying xterm to return keysyms for key > *releases* (in addition to key presses natrually). The keysyms would be > looked up in a table by their osf code (or something :-). A program that > wants to take advantage of this apparatus could then issue a control > sequence to turn it on and off and use a normalized table of keycodes > to work from. > > Aaaanyway, I would like to use UTF-8 to encode the keysym for sending > to the programs stdin but there is a problem; how do I encode the extra > bit of information necessary to indicate that a UTF-8 sequence is a key > release as opposed to a key press? > > Is there a way to encode /one more bit/ of information into a UTF-8 > sequence in a way that is mostly orthogonal to the encoding itself?
I would have thought that it would be better to use some kind of escape sequence than invalid UTF-8. For example, you could pick characters D and U and use DX or just X to mean "X pressed" and UX to mean "X released" (D=down, U=up). Normally, you would transmit just X rather than DX, but you would have to use DD and DU for D and U themselves being pressed. For efficiency you could choose D and U to be characters that don't often get typed, but there's nothing to stop you using the characters 'D' and 'U' if you want. Using a character that isn't too rare has the advantage of making bugs show up earlier. Edmund -- Linux-UTF8: i18n of Linux on all levels Archive: http://mail.nl.linux.org/linux-utf8/
