diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 359ee572..be72ac80 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2870,6 +2870,7 @@ Lars Hanisch for reporting a missing closing ')' in the help entry of the --vfat option for making the Recordings menu able to be called with a cRecordingFilter, which allows the caller to have it display only a certain subset of the recordings + for adding handling UTF-8 'umlaut' characters to cKbdRemote Alex Lasnier for adding tuning support for ATSC devices diff --git a/HISTORY b/HISTORY index cb7c72b7..6adbc91e 100644 --- a/HISTORY +++ b/HISTORY @@ -8075,3 +8075,4 @@ Video Disk Recorder Revision History - The Recordings menu can now be called with a cRecordingFilter, which allows the caller to have it display only a certain subset of the recordings (thanks to Lars Hanisch). +- Added handling UTF-8 'umlaut' characters to cKbdRemote (thanks to Lars Hanisch). diff --git a/remote.c b/remote.c index f3d90c96..f9349243 100644 --- a/remote.c +++ b/remote.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.c 2.8 2013/02/03 15:44:55 kls Exp $ + * $Id: remote.c 3.1 2013/12/25 12:45:43 kls Exp $ */ #include "remote.h" @@ -260,6 +260,7 @@ cKbdRemote::cKbdRemote(void) tcsetattr(STDIN_FILENO, TCSANOW, &tm); } kbdAvailable = true; + systemIsUtf8 = !cCharSetConv::SystemCharacterTable() || strcmp(cCharSetConv::SystemCharacterTable(), "UTF-8") == 0; Start(); } @@ -324,7 +325,23 @@ uint64_t cKbdRemote::ReadKeySequence(void) if ((key1 = ReadKey()) >= 0) { k = key1; - if (key1 == 0x1B) { + if (systemIsUtf8 && (key1 & 0xC0) == 0xC0) { + char bytes[4] = { 0 }; + bytes[0] = key1; + int bytescount = 1; + if ((key1 & 0xF0) == 0xF0) + bytescount = 3; + else if ((key1 & 0xE0) == 0xE0) + bytescount = 2; + for (int i = 0; i < bytescount; i++) { + if ((key1 = ReadKey()) >= 0) + bytes[i + 1] = key1; + } + k = Utf8CharGet(bytes); + if (k > 0xFF) + k = 0; + } + else if (key1 == 0x1B) { // Start of escape sequence if ((key1 = ReadKey()) >= 0) { k <<= 8; diff --git a/remote.h b/remote.h index 7c081d47..415f2e77 100644 --- a/remote.h +++ b/remote.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.h 2.1 2013/02/02 12:44:33 kls Exp $ + * $Id: remote.h 3.1 2013/12/25 12:32:44 kls Exp $ */ #ifndef __REMOTE_H @@ -106,6 +106,7 @@ class cKbdRemote : public cRemote, private cThread { private: static bool kbdAvailable; static bool rawMode; + bool systemIsUtf8; struct termios savedTm; virtual void Action(void); int ReadKey(void);