# I press the Russian key, and keyCode does not change

**URL:** <https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136>\
**Category:** Beginners\
**Created:** [January 17, 2021, 9:38am UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136 "2021-01-17T09:38:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Naik\_Trofimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/naik_trofimov/32/8143_2.png) [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Post date:** [January 17, 2021, 9:38am UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/1 "2021-01-17T09:38:38Z")

</div>

When using the Russian keyboard layout, not all letters have their own `keyCode`, such as: Б Ю Ж Э Х Ъ.  
On the English keyboard layout they are in the punctuation areas.  
However `key` displays them fine.  
the problem with obtaining the `keyCode` can be corrected through the `key`, but what I see is that Processing is not working properly and my decision will be considered a “crutch”.  
Is it possible to solve this problem at the level of the `keyCode` operation through your own project so as not to use “crutches” in the code?!

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 17, 2021, 1:31pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/2 "2021-01-17T13:31:58Z")

</div>

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/68c96caaf2bb98b3e380f4e4eaa27c11f78f71f0.png)  
enable this option in preferences. It should work

---

<div class="post-metadata">

**Author:** ![Naik\_Trofimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/naik_trofimov/32/8143_2.png) [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Post date:** [January 17, 2021, 1:38pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/3 "2021-01-17T13:38:25Z")

</div>

set enable it, not work

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 17, 2021, 5:25pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/4 "2021-01-17T17:25:14Z")

</div>

try to restart processing

---

<div class="post-metadata">

**Author:** ![Naik\_Trofimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/naik_trofimov/32/8143_2.png) [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Post date:** [January 17, 2021, 6:11pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/5 "2021-01-17T18:11:24Z")

</div>

Unfortunately, restarted Processing and computer, but this did not affect the problem.

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 17, 2021, 7:46pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/6 "2021-01-17T19:46:35Z")

</div>

you could map english keys to russian ones (a solution found on the old forum)  
so you can use

```auto
char[] from = ("abcdefgh").toCharArray();
char[] to = ("БЮЖЭХЪ.").toCharArray();
void keyPressed() {
    int keyID = -1;
    for(int i = 0; i < from.length; i++) if(key == from[i]) keyID = i;
    if(keyID != -1) {
         char newKey = char[keyID];
         <code using newKey instead of key>
    }
}

```

(don’t know the characters so I just copied the ones from above)

and don’t russian keys belong under “key” instead of “keycode” category?

---

<div class="post-metadata">

**Author:** ![Naik\_Trofimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/naik_trofimov/32/8143_2.png) [@Naik\_Trofimov](https://discourse.processing.org/u/Naik_Trofimov)\
**Post date:** [January 17, 2021, 9:12pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/7 "2021-01-17T21:12:21Z")

</div>

As far as I understand, the key and the key code duplicate each other and all keyboard keys should be perceived by them. If Russian keys do not belong to the key code, then why are most of them still perceived as a key code?  
Okay, I suppose you cannot solve the problem otherwise than with a “crutch”. There is no point in wasting your time and mine. Thanks for answers.

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 17, 2021, 9:20pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/8 "2021-01-17T21:20:34Z")

</div>

the keyCode and key solution:

```auto
void setup() {
  
}
void draw() {
  println(keyCode,key);
}

```

keyCode returns the ascii number, key returns a `char`

both are good for some things.  
keyCode is good for things like backspace,enter,shift,…  
key is good for characters not in ascii

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 17, 2021, 9:36pm UTC](https://discourse.processing.org/t/i-press-the-russian-key-and-keycode-does-not-change/27136/9 "2021-01-17T21:36:34Z")

</div>

from what I found out,  
the keyboard returns an ascii value, but the OS interprets it with a char. No matter the language set, “keyCode” (ascii) values are the same, but the “key” values change.
