Checking for UTF-8 at program start

This commit is contained in:
Klaus Schmidinger 2004-06-12 10:17:20 +02:00
parent e199411a28
commit 0e951afc2b
4 changed files with 25 additions and 5 deletions

View File

@ -730,6 +730,7 @@ Ludwig Nussel <ludwig.nussel@web.de>
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 <tom@harhar.net>
for his support in keeping the Premiere World channels up to date in 'channels.conf'

View File

@ -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.

12
INSTALL
View File

@ -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:
----------------------------------

12
vdr.c
View File

@ -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 <getopt.h>
@ -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;