Fixed handling 3 and 4 byte UTF-8 symbols in Utf8CharGet()

This commit is contained in:
Klaus Schmidinger 2008-02-29 13:23:02 +01:00
parent 4d6f0fb4c4
commit ff04bc72fd
3 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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).

View File

@ -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;
}