diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2008-02-29 13:23:02 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2008-02-29 13:23:02 +0100 |
commit | ff04bc72fd71e3e1771d21358c315255f9790715 (patch) | |
tree | 447b8d762ee7fc1d2c7a25a19c4a28b5a19c08ce | |
parent | 4d6f0fb4c45292765903f27df5bc1ffebbfd5f75 (diff) | |
download | vdr-ff04bc72fd71e3e1771d21358c315255f9790715.tar.gz vdr-ff04bc72fd71e3e1771d21358c315255f9790715.tar.bz2 |
Fixed handling 3 and 4 byte UTF-8 symbols in Utf8CharGet()
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | 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 <andreas@vdr-developer.org> 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 <jacquesolivier@hotmail.com>) for translating OSD texts to the French language @@ -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). @@ -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; } |