summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-02-29 13:23:02 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2008-02-29 13:23:02 +0100
commitff04bc72fd71e3e1771d21358c315255f9790715 (patch)
tree447b8d762ee7fc1d2c7a25a19c4a28b5a19c08ce /tools.c
parent4d6f0fb4c45292765903f27df5bc1ffebbfd5f75 (diff)
downloadvdr-ff04bc72fd71e3e1771d21358c315255f9790715.tar.gz
vdr-ff04bc72fd71e3e1771d21358c315255f9790715.tar.bz2
Fixed handling 3 and 4 byte UTF-8 symbols in Utf8CharGet()
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c8
1 files changed, 4 insertions, 4 deletions
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;
}