summaryrefslogtreecommitdiff
path: root/i18n.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-10-08 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-10-08 18:00:00 +0200
commit948c370a29a21ac1fc9531f7e92d99e24734dcf4 (patch)
treef3c468622249d515fb7be6a114f2ee44e8de895d /i18n.c
parent312c21b832f89b600e44850a870ee160631c5ecd (diff)
downloadvdr-patch-lnbsharing-948c370a29a21ac1fc9531f7e92d99e24734dcf4.tar.gz
vdr-patch-lnbsharing-948c370a29a21ac1fc9531f7e92d99e24734dcf4.tar.bz2
Version 1.4.3-1vdr-1.4.3-1
- The function cThread::Cancel() now only sets 'running' to false and does not actually kill the thread if the special value -1 is given (suggested by Udo Richter). - Changed the I18nNormalizeLanguageCode() check to also allow blanks (and all other printable characters) in the language codes (thanks to Boguslaw Juza for reporting that there are stations that use blanks in these codes). Blanks are replaced with underlines, so that all parts of VDR that rely on language codes to be one word (without blanks) work as expected. - Now clearing an event's Title, ShortText and Description if there is no ShortEventDescriptor or ExtendedEventDescriptor, respectively (thanks to Boguslaw Juza for reporting that events without an ExtendedEventDescriptor may get duplicate information in their ShortText through the EPG bugfixes in case they are received again). - Fixed handling video directory updates in case an other process has touched the .update file after the last NeedsUpdate() check (thanks to Petri Hintukainen). - Fixed handling language codes and descriptions of recorded audio tracks on channels with multiple tracks where not all of them appear in the event data (reported by Boguslaw Juza).
Diffstat (limited to 'i18n.c')
-rw-r--r--i18n.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/i18n.c b/i18n.c
index 34c81f6..ee529d4 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.282 2006/09/16 09:08:30 kls Exp $
+ * $Id: i18n.c 1.284 2006/10/08 08:50:30 kls Exp $
*
* Translations provided by:
*
@@ -6243,12 +6243,31 @@ 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 "???";
- }
+ for (int i = 0; i < 3; i++) {
+ if (Code[i]) {
+ // ETSI EN 300 468 defines language codes as consisting of three letters
+ // according to ISO 639-2. This means that they are supposed to always consist
+ // of exactly three letters in the range a-z - no digits, UTF-8 or other
+ // funny characters. However, some broadcasters apparently don't have a
+ // copy of the DVB standard (or they do, but are perhaps unable to read it),
+ // so they put all sorts of non-standard stuff into the language codes,
+ // like nonsense as "2ch" or "A 1" (yes, they even go as far as using
+ // blanks!). Such things should go into the description of the EPG event's
+ // ComponentDescriptor.
+ // So, as a workaround for this broadcaster stupidity, let's ignore
+ // language codes with unprintable characters...
+ if (!isprint(Code[i])) {
+ //dsyslog("invalid language code: '%s'", Code);
+ return "???";
+ }
+ // ...and replace blanks with underlines (ok, this breaks the 'const'
+ // of the Code parameter - but hey, it's them who started this):
+ if (Code[i] == ' ')
+ *((char *)&Code[i]) = '_';
+ }
+ else
+ break;
+ }
int n = I18nLanguageIndex(Code);
return n >= 0 ? I18nLanguageCode(n) : Code;
}