]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
EPG: handle new-line in webui and in the DVB string parser, fixes #3968
authorJaroslav Kysela <perex@perex.cz>
Sun, 1 Jan 2017 11:34:49 +0000 (12:34 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 1 Jan 2017 11:34:49 +0000 (12:34 +0100)
src/input/mpegts/dvb_support.c
src/webui/static/app/ext.css

index 41fbaefe344c27744d9f0e37047d220cc7cda356..16de3eee56f03088e30b76140db2f90c1c7c708c 100644 (file)
@@ -82,13 +82,21 @@ static inline size_t conv_UCS2(const uint8_t *src, size_t srclen,char *dst, size
 {
   while (srclen>0 && (*dstlen)>0){
     uint16_t uc = *src<<8|*(src+1);
-    int len = encode_utf8(uc, dst, *dstlen);
-    if (len == -1) {
-      errno = E2BIG;
-      return -1;
+    if (uc >= 0xe080 && uc <= 0xe09f) {
+      // codes 0xe080 - 0xe09f (control codes) are ignored except CR/LF
+      if (uc == 0xe08a) {
+        *dst = '\n';
+        (*dstlen)--;
+      }
     } else {
-      (*dstlen) -= len;
-      dst += len;
+      int len = encode_utf8(uc, dst, *dstlen);
+      if (len == -1) {
+        errno = E2BIG;
+        return -1;
+      } else {
+        (*dstlen) -= len;
+        dst += len;
+      }
     }
     srclen-=2;
     src+=2;
@@ -129,7 +137,11 @@ static inline size_t conv_8859(int conv,
       (*dstlen)--;
       dst++;
     } else if (c <= 0x9f) {
-      // codes 0x80 - 0x9f (control codes) are ignored
+      // codes 0x80 - 0x9f (control codes) are ignored except CR/LF
+      if (c == 0x8a) {
+        *dst = '\n';
+        (*dstlen)--;
+      }
     } else {
       // map according to character table, skipping
       // unmapped chars (value 0 in the table)
@@ -166,7 +178,11 @@ static inline size_t conv_6937(const uint8_t *src, size_t srclen,
       (*dstlen)--;
       dst++;
     } else if (c <= 0x9f) {
-      // codes 0x80 - 0x9f (control codes) are ignored
+      // codes 0x80 - 0x9f (control codes) are ignored except CR/LF
+      if (c == 0x8a) {
+        *dst = '\n';
+        (*dstlen)--;
+      }
     } else {
       uint16_t uc;
       if (c >= 0xc0 && c <= 0xcf) {
index 21e9058b16066db6d5d42ab92cf9acbfd4f80ee7..0a5acd21b03dc486c24fa4e67dfab2f85c6ba98f 100644 (file)
     font-weight: bold;
     text-align: center;
     border-bottom: 1px solid #000000;
+    white-space: pre-wrap;
 }
 
 .x-epg-subtitle {
     margin: 5px;
     font: normal 12px arial, tahoma, helvetica, sans-serif;
     font-weight: bold;
+    white-space: pre-wrap;
 }
 
 .x-epg-prefix {
 .x-epg-summary {
     margin: 5px;
     font-weight: bold;
+    white-space: pre-wrap;
 }
 
 .x-epg-desc {
     margin: 10px;
+    white-space: pre-wrap;
 }
 
 .x-epg-left {