From patchwork Sun Dec 6 19:55:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCnster?= X-Patchwork-Id: 32123 Received: from localhost ([127.0.0.1] helo=www.linuxtv.org) by www.linuxtv.org with esmtp (Exim 4.84) (envelope-from ) id 1a5fPT-0003pH-L3; Sun, 06 Dec 2015 19:55:51 +0000 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84) (envelope-from ) id 1a5fPP-0003or-Tr for vdr@linuxtv.org; Sun, 06 Dec 2015 19:55:48 +0000 X-tubIT-Incoming-IP: 80.91.229.3 Received: from plane.gmane.org ([80.91.229.3]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtps [TLSv1:AES256-SHA:256] for id 1a5fPO-0002AZ-7s; Sun, 06 Dec 2015 20:55:47 +0100 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a5fPL-0003g1-4O for vdr@linuxtv.org; Sun, 06 Dec 2015 20:55:43 +0100 Received: from arennes-651-1-345-155.w2-14.abo.wanadoo.fr ([2.14.80.155]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Dec 2015 20:55:43 +0100 Received: from pmlists by arennes-651-1-345-155.w2-14.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Dec 2015 20:55:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: vdr@linuxtv.org From: =?utf-8?Q?Peter_M=C3=BCnster?= Date: Sun, 06 Dec 2015 20:55:32 +0100 Lines: 58 Message-ID: <87egez5p3f.fsf@roche-blanche.net> References: <87h9k53qje.fsf@roche-blanche.net> <46CB308F-1E11-4150-8166-BC0B2ACAD04B@tvdr.de> <87k2oweism.fsf@free.fr> Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: arennes-651-1-345-155.w2-14.abo.wanadoo.fr User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:eldVwgYeijEgZDZRGjYAplWRnuk= X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.12.6.195117 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1700_1799 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, REFERENCES 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __HAS_FROM 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __USER_AGENT 0' X-LSpam-Score: 0.6 (/) X-LSpam-Report: No, score=0.6 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_LOW=-0.7, RDNS_NONE=1.274, SPF_HELO_PASS=-0.001 autolearn=no autolearn_force=no Subject: Re: [vdr] bad characters in epg.data X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: VDR Mailing List Errors-To: vdr-bounces@linuxtv.org Sender: "vdr" On Wed, Dec 02 2015, Klaus Schmidinger wrote: >> C S19.2E-133-3-263 SVM - GR\326D >> >> Would it be possible/easy to patch vdr to filter out such errors? >> What is the right function to look at? > > Take a look at StripControlCharacters() or cEvent::FixEpgBugs() in epg.c. It seems, that these functions only take care of the title and the description, but not the channel name. Finally, I've patched vdr like this: --8<---------------cut here---------------start------------->8--- --8<---------------cut here---------------end--------------->8--- It seems to work. Would it be possible to integrate this patch into vdr? --- epg.c~ 2013-12-28 12:33:08.000000000 +0100 +++ epg.c 2015-12-06 15:54:58.312233837 +0100 @@ -1064,11 +1064,32 @@ } } +static char *StripFunny8bitCharacters(const char *src) +{ + static char dest[100]; + strn0cpy(dest, src, 100); + char *s = dest; + int len = strlen(s); + while (len > 0) { + int l = Utf8CharLen(s); + uchar *p = (uchar *)s; + if (l == 1 && *p > 0x7F) { // this is not utf-8 + memmove(s, p + 1, len); // we also copy the terminating 0! + len--; + l = 0; + } + s += l; + len -= l; + } + return dest; +} + void cSchedule::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtTime) const { cChannel *channel = Channels.GetByChannelID(channelID, true); if (channel) { - fprintf(f, "%sC %s %s\n", Prefix, *channel->GetChannelID().ToString(), channel->Name()); + fprintf(f, "%sC %s %s\n", Prefix, *channel->GetChannelID().ToString(), + StripFunny8bitCharacters(channel->Name())); const cEvent *p; switch (DumpMode) { case dmAll: {