lib/util/charset correct calculation of UTF8 character sizes
authorAndrew Bartlett <abartlet@samba.org>
Wed, 30 Mar 2011 23:26:08 +0000 (10:26 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 Mar 2011 23:52:42 +0000 (10:52 +1100)
Characters between 0x800 0x0FFFF are 3 bytes long.

Andrew Bartlett

lib/util/charset/util_str.c

index 30961d068a3eed3fa03cf24f1e6252c54e6381bd..ff53b1875ea0022f42875a52483a4c8c73f5b35b 100644 (file)
@@ -184,7 +184,7 @@ _PUBLIC_ size_t strlen_m_ext(const char *s, charset_t src_charset, charset_t dst
                                count += 1;
                        } else if (c < 0x800) {
                                count += 2;
-                       } else if (c < 0x1000) {
+                       } else if (c < 0x10000) {
                                count += 3;
                        } else {
                                count += 4;