From: Jaroslav Kysela Date: Sun, 1 Jan 2017 11:34:49 +0000 (+0100) Subject: EPG: handle new-line in webui and in the DVB string parser, fixes #3968 X-Git-Tag: v4.2.1~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df352fdde67087afc6d529dd4a0206b9b751b4af;p=thirdparty%2Ftvheadend.git EPG: handle new-line in webui and in the DVB string parser, fixes #3968 --- diff --git a/src/input/mpegts/dvb_support.c b/src/input/mpegts/dvb_support.c index 41fbaefe3..16de3eee5 100644 --- a/src/input/mpegts/dvb_support.c +++ b/src/input/mpegts/dvb_support.c @@ -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) { diff --git a/src/webui/static/app/ext.css b/src/webui/static/app/ext.css index 21e9058b1..0a5acd21b 100644 --- a/src/webui/static/app/ext.css +++ b/src/webui/static/app/ext.css @@ -652,12 +652,14 @@ 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 { @@ -674,10 +676,12 @@ .x-epg-summary { margin: 5px; font-weight: bold; + white-space: pre-wrap; } .x-epg-desc { margin: 10px; + white-space: pre-wrap; } .x-epg-left {