Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

when in console, if I press a key, some interrupt controller sends code of that key to CPU, which looks into some table and than represent that keypress by printing some charracter to stdout. But, is keyboard sending an ASCII code of that key, or just some standardised code? Since there is so many languages and extra characters, OS must further translate its code into some character according to user selected scheme, I guess. I ask, becouse I am from Czech Republic, and we use some characters that do not exists in standart ASCII code. So I was thinking, if I enter this character into a console, and then print it, lets say in C++ using cin and cout, and I have set locale to Czech, stdin must actually send some non-ASCII code of the character I pressed to input stream. Am I right?

share|improve this question
What platform? Windows, Linux or Mac OS X? – Peter Mortensen Mar 9 '10 at 12:48

For the first question: keyboards send scancodes, not ASCII or Unicode.

Software on the computer then interprets the scancodes, e.g. the BIOS during boot or the operating system. E.g. in Linux scancodes and shifting state are interpreted by kernel key maps that translate keycodes to 16 bit numbers, which are normally Unicode/ASCII characters.

share|improve this answer

You must log in to answer this question.