diff options
-rw-r--r-- | osdep/getch2.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/osdep/getch2.c b/osdep/getch2.c index f421bdea7e..1a92866afd 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -57,6 +57,7 @@ #include <unistd.h> #include <fcntl.h> +#include "bstr.h" #include "mp_fifo.h" #include "input/keycodes.h" #include "getch2.h" @@ -201,6 +202,16 @@ void getch2(struct mp_fifo *fifo) len = 2; } code = KEY_ENTER; + } else { + int utf8len = bstr_parse_utf8_code_length(code); + if (utf8len > 0 && utf8len <= getch2_len) { + struct bstr s = { getch2_buf, utf8len }; + int unicode = bstr_decode_utf8(s, NULL); + if (unicode > 0) { + len = utf8len; + code = unicode; + } + } } } else if (getch2_len > 1) { |