keyboard interface

Nov 14, 2004 8 Replies

I'd like to be able to read cursor keys from a keyboard as part of an "official" character code set if possible.



Are these key codes included somewhere in the unicode character set ? Or is there a standard practice for handling these keys ?



Thanks, Rob


What sort of keyboard? PS2? if so there is a scan code for every key, just look on the scancode table. You do have a table ?

A guess, since your question was rather vague - are you doing something over a serial link, and trying to add support for command-line editing using the cursor keys? If so, the keystrokes sent by those keys are dependent on the terminal emulation software you're running.

termcaps and a lot of frustration, generally :)

formatting link
formatting link
formatting link
formatting link
formatting link

Unicode is for characters, not for keys. The difference may be subtle, but suffice it to say that cursors keys are patently outside the scope of unicode.

Have a look at ANSI terminal control characters instead. Note that they'll be multi-byte sequences, not single-byte codes, though.

Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

I'm using a PS2 compatible keyboard. I have a hardware interface that translates the scan code into unicode (ascii at the moment) and makes it available in an IO port. What I'm trying to do is make a keyboard that returns unicode characters rather than scan-codes. I would like to translate the scan-codes for the cursor edit keys into their equivalent unicode values. What are these values ?

Thanks, Rob

Maybe an example would help. If I press cursor left on the keyboard, what is the equivalent unicode character ?

Rob

I think we all understood the question correctly the first time you asked it. What you're not understanding is that it may be the wrong question to ask. Unicode is not designed to represent keyboard input, and as such, it's somewhat unlikely it'll have code points for things that aren't characters. But don't take my word for it: go look it up yourself.www.unicode.org awaits your visit.

Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

There is none. It'd probably be helpful if there was, but there isn't.

You want VT100 codes, or something like that.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required