In case keyboard profile "Option Key as +Esc" and terminal profile "Encoding Cyrillic (KOI8-R)".
<option>+<cyrilic letter=""> send to program 3 bytes: ESC and UTF-8 coded letter. It's wrong.
Correct behavior: send to program two-character sequence: ESC and KOI8-R coded letter.
iTerm:
$ echo $LANG
ru_RU.koi8-r
$ od -c -t x1
q^[qй^[п╧
0000000 q 033 q й 033 п ╧ \n
71 1b 71 ca 1b d0 b9 0a
xterm, gnome-terminal, PuTTY:
$ echo $LANG
ru_RU.KOI8-R
$ od -c -t x1
q^[qй^[й
0000000 q 033 q й 033 й \n
71 1b 71 ca 1b ca 0a
$ uname -a
Darwin leom 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
ITerm Build 0.10