UPC is a provider for middle european countries (Czechia, Hungary and Poland). 
They use iso6937-2 for encoding their EPG data so this looks quite strange in 
the vdr.
The applied patch does a "remapping" to iso8859-2 so that characters are 
displayed correct. (Currently only tested with Czech and Hungarian, but 
should also work for Polish)

While testing this with the help of an hungarian user, i also found out that 
the the codepage for Hungary must be 8859-2, not -1.

The patch is work by Helmut Auer.

cheers,
Tim
--- vdr-1.4.4-vanilla/epg.c	2006-10-28 11:12:42.000000000 +0200
+++ vdr-1.4/epg.c	2006-11-28 12:39:33.000000000 +0100
@@ -18,6 +18,165 @@

 #define RUNNINGSTATUSTIMEOUT 30 // seconds before the running status is considered unknown

+// UPC Direct / HBO strange two-character encoding. 0xC2 means acute, 0xCF caron.
+// many thanks to the czechs who helped me while solving this.
+void checkUPC( char *str )
+{
+   char *s1 = str;
+   char *s2 = str;
+   char nc;
+
+   if (!str)
+      return;
+
+   while (*s1 != '\0') {
+      nc = *s1;
+      switch (*s1) {
+         case 0xC2: // acute: á é í ó ú ý
+            s1++;
+            switch (*s1) {
+               case 'A': nc = (char)0xC1;
+                  break;
+               case 'a': nc = (char)0xE1;
+                  break;
+               case 'E': nc = (char)0xC9;
+                  break;
+               case 'e': nc = (char)0xE9;
+                  break;
+               case 'I': nc = (char)0xCD;
+                  break;
+               case 'i': nc = (char)0xED;
+                  break;
+               case 'O': nc = (char)0xD3;
+                  break;
+               case 'o': nc = (char)0xF3;
+                  break;
+               case 'U': nc = (char)0xDA;
+                  break;
+               case 'u': nc = (char)0xFA;
+                  break;
+               case 'Y': nc = (char)0xDD;
+                  break;
+               case 'y': nc = (char)0xFD;
+                  break;
+               default:
+                  s1--;
+                  break;
+            }
+	         break;
+         case 0xC6:
+            s1++;
+            switch (*s1) {
+               case 'S': nc = (char)0xA9;
+                  break;
+               case 's': nc = (char)0xB9;
+                  break;
+               default:
+                  s1--;
+                  break;
+            }
+            break;
+         case 0xC8:
+            s1++;
+            switch (*s1) {
+               case 'A': nc = (char)0xC4;
+                  break;
+               case 'a': nc = (char)0xE4;
+                  break;
+               case 'O': nc = (char)0xD6;
+                  break;
+               case 'o': nc = (char)0xF6;
+                  break;
+               case 'U': nc = (char)0xDC;
+                  break;
+               case 'u': nc = (char)0xFC;
+                  break;
+               default:
+                  s1--;
+                  break;
+            }
+            break;
+         case 0xCA: // krouzek http://de.wikipedia.org/wiki/Krouzek
+            s1++;
+            switch (*s1) {
+               case 'U': nc = (char)0xD9;
+                  break;
+               case 'u': nc = (char)0xF9;
+                  break;
+               default:
+                  s1--;
+                  break;
+            }
+            break;
+         case 0xCD:
+            s1++;
+            switch (*s1) {
+               case 'O': nc = (char)0xD5;
+                  break;
+               case 'o': nc = (char)0xF5;
+                  break;
+               case 'U': nc = (char)0xDB;
+                  break;
+               case 'u': nc = (char)0xFB;
+                  break;
+               default:
+                  s1--;
+                  break;
+            }
+            break;
+         case 0xCF: // caron
+            s1++;
+            switch (*s1) {
+               case 'C': nc =  (char)0xC8;
+                  break;
+               case 'c': nc =  (char)0xE8;
+                  break;
+               case 'D': nc =  (char)0xCF;
+                  break;
+               case 'd': nc =  (char)0xEF;
+                  break;
+               case 'E': nc =  (char)0xCC;
+                  break;
+               case 'e': nc =  (char)0xEC;
+                  break;
+               case 'L': nc =  (char)0xC5;        // not sure if they really exist.
+                  break;
+               case 'l': nc =  (char)0xE5;
+                  break;
+               case 'N': nc =  (char)0xD2;
+                  break;
+               case 'n': nc =  (char)0xF2;
+                  break;
+               case 'R': nc =  (char)0xD8;
+                  break;
+               case 'r': nc =  (char)0xF8;
+                  break;
+               case 'S': nc =  (char)0xA9;
+                  break;
+               case 's': nc =  (char)0xB9;
+                  break;
+               case 'T': nc =  (char)0xAB;
+                  break;
+               case 't': nc =  (char)0xBB;
+                  break;
+               case 'Z': nc =  (char)0xAE;
+                  break;
+               case 'z': nc =  (char)0xBE;
+                  break;
+               default:
+                  s1--;
+                  break;
+            }
+	         break;
+         default:
+            break;
+      }
+      s1++;
+      *s2 = nc;
+      s2++;
+   }
+   *s2 = '\0';
+}
 // --- tComponent ------------------------------------------------------------

 cString tComponent::ToString(void)
@@ -641,6 +800,11 @@
   strreplace(shortText, '\x87', ' ');
   strreplace(description, '\x86', ' ');
   strreplace(description, '\x87', ' ');
+
+  // Check for some strange czech characters :)
+  checkUPC( title );
+  checkUPC( shortText );
+  checkUPC( description );
 }

 // --- cSchedule -------------------------------------------------------------
--- vdr-1.4.4-vanilla/i18n.c	2006-10-14 11:26:41.000000000 +0200
+++ vdr-1.4/i18n.c	2006-12-08 19:31:00.000000000 +0100
@@ -119,7 +119,7 @@
     "iso8859-7",
     "iso8859-1",
     "iso8859-2",
-    "iso8859-1",
+    "iso8859-2",
     "iso8859-1",
     "iso8859-5",
     "iso8859-2",
_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to