summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-09-29 14:30:48 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2012-09-29 14:30:48 +0200
commit3c860ee0439bf106413a759c284de616d31da638 (patch)
tree92c470b8fce785c89985895cb3e4d988d6f9fd7b
parentc5dfaf9681b25de03fe18909bd08f52797c2cf41 (diff)
downloadvdr-3c860ee0439bf106413a759c284de616d31da638.tar.gz
vdr-3c860ee0439bf106413a759c284de616d31da638.tar.bz2
Reactivated stripping control characters from EPG texts and adapted it to UTF-8
-rw-r--r--HISTORY1
-rw-r--r--epg.c33
2 files changed, 25 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index fdf09457..3d8ff02e 100644
--- a/HISTORY
+++ b/HISTORY
@@ -7262,3 +7262,4 @@ Video Disk Recorder Revision History
thread to avoid sluggish response to user input on slow systems (based on a patch from
Sören Moch).
- Fixed sorting folders before recordings in case of UTF-8 (thanks to Sören Moch).
+- Reactivated stripping control characters from EPG texts and adapted it to UTF-8.
diff --git a/epg.c b/epg.c
index d96c0fda..1c1ecdf5 100644
--- a/epg.c
+++ b/epg.c
@@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
- * $Id: epg.c 2.20 2012/09/29 11:49:11 kls Exp $
+ * $Id: epg.c 2.21 2012/09/29 14:29:49 kls Exp $
*/
#include "epg.h"
@@ -641,6 +641,26 @@ void ReportEpgBugFixStats(bool Force)
}
}
+static void StripControlCharacters(char *s)
+{
+ if (s) {
+ int len = strlen(s);
+ while (len > 0) {
+ int l = Utf8CharLen(s);
+ uchar *p = (uchar *)s;
+ if (l == 2 && *p == 0xC2) // UTF-8 sequence
+ p++;
+ if (*p == 0x86 || *p == 0x87) {
+ memmove(s, p + 1, len - l + 1); // we also copy the terminating 0!
+ len -= l;
+ l = 0;
+ }
+ s += l;
+ len -= l;
+ }
+ }
+}
+
void cEvent::FixEpgBugs(void)
{
if (isempty(title)) {
@@ -850,15 +870,10 @@ Final:
strreplace(p->description, '\n', ' ');
}
}
- /* TODO adapt to UTF-8
// Same for control characters:
- strreplace(title, '\x86', ' ');
- strreplace(title, '\x87', ' ');
- strreplace(shortText, '\x86', ' ');
- strreplace(shortText, '\x87', ' ');
- strreplace(description, '\x86', ' ');
- strreplace(description, '\x87', ' ');
- XXX*/
+ StripControlCharacters(title);
+ StripControlCharacters(shortText);
+ StripControlCharacters(description);
}
// --- cSchedule -------------------------------------------------------------