From ff04bc72fd71e3e1771d21358c315255f9790715 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 29 Feb 2008 13:23:02 +0100 Subject: Fixed handling 3 and 4 byte UTF-8 symbols in Utf8CharGet() --- CONTRIBUTORS | 1 + HISTORY | 4 +++- tools.c | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 044f33d3..ee547adb 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -957,6 +957,7 @@ Andreas Mair not NULL for making the SVDRP command LSTC list the channels with group separators if the option ':groups' is given + for fixing handling 3 and 4 byte UTF-8 symbols in Utf8CharGet() Olivier Jacques ) for translating OSD texts to the French language diff --git a/HISTORY b/HISTORY index 2c136059..c1a7cf39 100644 --- a/HISTORY +++ b/HISTORY @@ -5671,7 +5671,7 @@ Video Disk Recorder Revision History - Added the backslash ('\') to the list of characters that need to be escaped when executing external commands (thanks to Peter Bieringer for reporting this one). -2008-02-27: Version 1.5.17 +2008-02-29: Version 1.5.17 - Updated the Swedish OSD texts (thanks to Tomas Berglund). - Made the 'pic2mpg' script of the 'pictures' plugin work with uppercase filename @@ -5680,3 +5680,5 @@ Video Disk Recorder Revision History - Updated the Dutch OSD texts (thanks to Johan Schuring). - Stripping control codes 0x86 and 0x87 from SI strings. - Updated French language texts (thanks to Jean-Claude Repetto). +- Fixed handling 3 and 4 byte UTF-8 symbols in Utf8CharGet() (thanks to Andreas + Mair). diff --git a/tools.c b/tools.c index 64f4464d..e5bb40a9 100644 --- a/tools.c +++ b/tools.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.143 2008/02/16 13:38:22 kls Exp $ + * $Id: tools.c 1.144 2008/02/29 13:16:39 kls Exp $ */ #include "tools.h" @@ -630,9 +630,9 @@ uint Utf8CharGet(const char *s, int Length) if (!Length) Length = Utf8CharLen(s); switch (Length) { - case 2: return ((*s & 0x1F) << 6) | (*(s + 1) & 0x3F); - case 3: return ((*s & 0x0F) << 4) | ((*(s + 1) & 0x3F) << 6) | (*(s + 2) & 0x3F); - case 4: return ((*s & 0x07) << 2) | ((*(s + 1) & 0x3F) << 4) | ((*(s + 2) & 0x3F) << 6) | (*(s + 3) & 0x3F); + case 2: return ((*s & 0x1F) << 6) | (*(s + 1) & 0x3F); + case 3: return ((*s & 0x0F) << 12) | ((*(s + 1) & 0x3F) << 6) | (*(s + 2) & 0x3F); + case 4: return ((*s & 0x07) << 18) | ((*(s + 1) & 0x3F) << 12) | ((*(s + 2) & 0x3F) << 6) | (*(s + 3) & 0x3F); } return *s; } -- cgit v1.2.3