More on handling [Unicode] input in the console
by Michael S. Kaplan, published on 2005/12/16 05:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/12/16/504511.aspx
Yesterday, I talked a little about handling [Unicode] input in the console, although I did fail to talk about one interesting/important case -- the Input Method Editor (IME).
Now not all IMEs seem to work in the console (more likely I just do not know all the tricks on this!). I decided to stick with the one I know, the Unicode IME (the one I talked about in this post).
It does indeed work in the console, though it does seem to require a default system locale of 950 (kind of ironic given what this IME is, though we will talk about it another time maybe).
Here is my console running that code I posted yesterday, note the bottom left hand corner:
I will try to type the Unicode code unit U+AC00 (Hangul Syllable Kiyeok A). We will look at the keyboard event records the whole way through.
First the A:
Then the C:
The pattern is becoming clear now, isn't it? :-)
Next comes the first 0 (zero).
And now the final 0 (zero):
So, we have a few things to note here:
- There is yet another undocumented state being returned -- in this case 0x840000. I have no clue what this state means.
- The IME is not forwarding the KeyDown information, though it is forwarding the KeyUp info, until it has the actual character to insert.
- There are other events happening here that are not type KEY_EVENT (since we are checking for that).
- Since the other choices are FOCUS_EVENT, MENU_EVENT, MOUSE_EVENT, and WINDOW_BUFFER_SIZE_EVENT, none of which seem appropriate, at some point I am going to alter the sample to figure out just what kind of event it is.
- The previous point is just a matter of intellectual curiousity since I have a clear way to proceed in regard to getting the keyboard input from the IME.
- There is a small point of contrast to the <ALT>+NUMPAD case I talked about yesterday -- in that case the KeyDown and KeyUp events were both happening, but no character was being returned until the end (in the case of the IME, only KeyUp events were retrieved until the end).
- It is possible to decipher both kinds of information, though it could get pretty complicated trying to do so.
- I hope that other IMEs that work in the console doing things in a similar or identical way!
There is the interim report, I am sure I'll say more after I have had some time to do a fuller investigation....
This post brought to you by "가" (U+ac00, a.k.a. Hangul Syllable Kiyeok A)
# Martin Bohring on 16 Dec 2005 8:49 AM:
"I hope that other IMEs that work in the console doing things in a similar or identical way!"
I would not count on that. Judging IME behaviour in general seems to require a grade in forensic analysis
# Michael S. Kaplan on 16 Dec 2005 11:39 AM:
You are probably right. It is definitely what I saw when I could not get some to work at all.
I am hoping though that the event behavior will be similar since in that case the variable nature of the IMEs is forced into behaving in some way to work within the IMM interface....
go to newer or older post, or back to index or month or day