From 0e951afc2b8966039177f60b413bc1df245fcbaa Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 12 Jun 2004 10:17:20 +0200 Subject: [PATCH] Checking for UTF-8 at program start --- CONTRIBUTORS | 1 + HISTORY | 5 ++++- INSTALL | 12 ++++++++++-- vdr.c | 12 ++++++++++-- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d6f34f1d..ea9354a2 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -730,6 +730,7 @@ Ludwig Nussel for reporting a problem with the LIRC remote control trying to learn keys even if it couldn't connect to the LIRC daemon for making the plugin library directory configurable via Make.config + for reporting a problem on systems that have UTF-8 enabled Thomas Koch for his support in keeping the Premiere World channels up to date in 'channels.conf' diff --git a/HISTORY b/HISTORY index 03698ddb..c2a7c343 100644 --- a/HISTORY +++ b/HISTORY @@ -2893,7 +2893,7 @@ Video Disk Recorder Revision History strings in order to avoid buffer overflows (thanks to Philip Lawatsch for debugging a buffer overflow in eit.c). -2004-06-10: Version 1.3.11 +2004-06-12: Version 1.3.11 - In order to avoid problems on NPTL systems, VDR now checks for the presence of NPTL at program start, and if it is, exists and tells the user to do @@ -2901,3 +2901,6 @@ Video Disk Recorder Revision History - Revoked the "Fixed missing audio after replaying a DVD" change because it introduced a sound disturbance when switching between channels on the same transponder. +- In order to avoid problems on UTF-8 systems, VDR now checks for the presence + of UTF-8 at program start, and if it is, exists and tells the user to turn off + UTF-8 before starting VDR. diff --git a/INSTALL b/INSTALL index 012dd946..4eefa98b 100644 --- a/INSTALL +++ b/INSTALL @@ -4,8 +4,8 @@ Installation of the Video Disk Recorder Version 1.3 ----------- -IMPORTANT NOTE: ---------------- +IMPORTANT NOTES: +---------------- VDR currently doesn't work with NPTL ("Native Posix Thread Library"). Either don't use NPTL, or set the environment variable @@ -14,6 +14,14 @@ Either don't use NPTL, or set the environment variable before running VDR. +Also, please make sure your environment is NOT set to use UTF-8 or +any other multibyte character representation. Check the value of your +$LANG or $LC_CTYPE environment variable, and if it contains something +like "de_DE.UTF-8", make sure you set it to something like "de_DE.iso8859-1" +or whatever single byte character mode you want. If you run VDR with +UTF-8 enabled, it may crash in case it encounters EPG or channel data +that contains non-7-bit ASCII characters. + Compiling and running the program: ---------------------------------- diff --git a/vdr.c b/vdr.c index de042d4e..23f24957 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.182 2004/06/10 13:22:08 kls Exp $ + * $Id: vdr.c 1.183 2004/06/12 10:07:17 kls Exp $ */ #include @@ -89,12 +89,20 @@ int main(int argc, char *argv[]) char LibPthreadVersion[128]; if (confstr(_CS_GNU_LIBPTHREAD_VERSION, LibPthreadVersion, sizeof(LibPthreadVersion) > 0)) { if (strstr(LibPthreadVersion, "NPTL")) { - fprintf(stderr, "vdr: please turn off NPTL by setting 'export LD_ASSUME_KERNEL=2.4.1' before starting VDR"); + fprintf(stderr, "vdr: please turn off NPTL by setting 'export LD_ASSUME_KERNEL=2.4.1' before starting VDR\n"); return 2; } } #endif + // Check for UTF-8 and exit if present - asprintf() will fail if it encounters 8 bit ASCII codes + char *LangEnv; + if ((LangEnv = getenv("LANG")) != NULL && strcasestr(LangEnv, "utf") || + (LangEnv = getenv("LC_TYPE")) != NULL && strcasestr(LangEnv, "utf")) { + fprintf(stderr, "vdr: please turn off UTF-8 before starting VDR\n"); + return 2; + } + // Save terminal settings: struct termios savedTm;