changeset 48:f937475e9baa

[/trunk] Changeset 64 by mikael * Last fix was not correct (which does not mean this one is...) :-(
author mikael
date Wed, 06 Apr 2005 10:12:44 +0000
parents 7259a61e1a4b
children 18a03a69f5e4
files mcabber/src/utf8.c
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/utf8.c	Wed Apr 06 10:07:59 2005 +0000
+++ b/mcabber/src/utf8.c	Wed Apr 06 10:12:44 2005 +0000
@@ -41,19 +41,15 @@
 char *utf8_encode(const char *src)
 {
   char *ret = calloc(1, (strlen(src) * 2) + 1);
-  unsigned char *aux = ret;
+  unsigned char *aux = (unsigned char*)ret;
 
   while (*src) {
     unsigned char ch = *src++;
     if (ch < 0x80U) {
       *aux++ = ch;
-    } else if (ch < 0x800U) {			/* if (ch < 0x800) { */
+    } else {  /* if (ch < 0x800U) { */
       *aux++ = 0xc0 | (ch >> 6);
       *aux++ = 0x80 | (ch & 0x3f);
-    } else {
-      *aux++ = 0xe0 | (ch >> 12);
-      *aux++ = 0x80 | ((ch >> 6) & 0x3f);
-      *aux++ = 0x80 | (ch & 0x3f);
     }
   }