summaryrefslogtreecommitdiff
path: root/i18n.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2004-11-14 14:28:29 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2004-11-14 14:28:29 +0100
commitc834d84db0c216997368d80e47cf0bba0a2f9e68 (patch)
tree915cd88823e400a5dd790b1ba85e843562e0a38f /i18n.c
parente656c86153c46956dd878da5d5c1c455f86b8892 (diff)
downloadvdr-c834d84db0c216997368d80e47cf0bba0a2f9e68.tar.gz
vdr-c834d84db0c216997368d80e47cf0bba0a2f9e68.tar.bz2
Checking PID language codes for ISO 639 compliance
Diffstat (limited to 'i18n.c')
-rw-r--r--i18n.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/i18n.c b/i18n.c
index 2f096bb2..75756041 100644
--- a/i18n.c
+++ b/i18n.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: i18n.c 1.162 2004/11/06 10:26:52 kls Exp $
+ * $Id: i18n.c 1.163 2004/11/14 14:28:29 kls Exp $
*
* Translations provided by:
*
@@ -75,6 +75,7 @@
*/
#include "i18n.h"
+#include <ctype.h>
#include "config.h"
#include "tools.h"
@@ -5222,6 +5223,12 @@ int I18nLanguageIndex(const char *Code)
const char *I18nNormalizeLanguageCode(const char *Code)
{
+ if (Code[0] && !isalnum(Code[0]) || Code[1] && !isalnum(Code[1]) || Code[2] && !isalnum(Code[2])) {
+ // ISO 639 language codes are defined as alphabetical characters, but digits are apparently
+ // also used, for instance for "2ch"
+ //dsyslog("invalid language code: '%s'", Code);
+ return "???";
+ }
int n = I18nLanguageIndex(Code);
return n >= 0 ? I18nLanguageCode(n) : Code;
}