projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6d77e79
)
Fix detecting of UTF8 Sequences
author
Wilfried Goesgens
<dothebart@citadel.org>
Fri, 19 Aug 2011 17:12:32 +0000
(17:12 +0000)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Fri, 19 Aug 2011 17:13:53 +0000
(17:13 +0000)
- we need to exactly check for both highest bits to be set, not one of them.
libcitadel/lib/stringbuf.c
patch
|
blob
|
history
diff --git
a/libcitadel/lib/stringbuf.c
b/libcitadel/lib/stringbuf.c
index 8718ec065a68ac6e38913def4fc30a84226c75da..df35593ea49d7f9ee3db0d50b058b6f652ae7672 100644
(file)
--- a/
libcitadel/lib/stringbuf.c
+++ b/
libcitadel/lib/stringbuf.c
@@
-3179,7
+3179,7
@@
static inline int Ctdl_GetUtf8SequenceLength(const char *CharS, const char *Char
int n = 0;
unsigned char test = (1<<7);
- if ((*CharS & 0xC0)
==
0)
+ if ((*CharS & 0xC0)
!= 0xC
0)
return 1;
while ((n < 8) &&
@@
-3202,7
+3202,7
@@
static inline int Ctdl_GetUtf8SequenceLength(const char *CharS, const char *Char
static inline int Ctdl_IsUtf8SequenceStart(const char Char)
{
/** 11??.???? indicates an UTF8 Sequence. */
- return ((Char & 0xC0)
!=
0);
+ return ((Char & 0xC0)
== 0xC
0);
}
/**