ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.10,1.11


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/yahoo2 yahoo.c,1.10,1.11
Date: Tue, 14 Jan 2003 18:30:19 -0500

Update of /cvsroot/ayttm/ayttm/modules/yahoo2
In directory subversions:/tmp/cvs-serv19500/modules/yahoo2

Modified Files:
        yahoo.c 
Log Message:
fix utf8 handling in yahoo2



Index: yahoo.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/yahoo2/yahoo.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- yahoo.c     14 Jan 2003 22:17:27 -0000      1.10
+++ yahoo.c     14 Jan 2003 23:30:16 -0000      1.11
@@ -723,22 +723,24 @@
                char buff[2048];
 
                int i=0,j=0;
-               while(msg[i]) {
-                       if(msg[i] < (char)0x80) {       /* 7 bit ASCII */
-                               msg[j] = msg[i];
-                               i++;
-                       } else if(msg[i] < (char)0xC4) {/* ISOLatin1 */
-                               msg[j] = (msg[i]<<6) | (msg[i+1] & 0xC0);
+               unsigned char *umsg = (unsigned char *)msg;
+               while(umsg[i]) {
+                       if(umsg[i] < (unsigned char)0x80) {     /* 7 bit ASCII 
*/
+                               umsg[j] = umsg[i];
+                               i++; 
+                       } else if(umsg[i] < (unsigned char)0xC4) {/* ISOLatin1 
*/
+                               umsg[j] = (umsg[i]<<6) | (umsg[i+1] & 0x3F);
                                i+=2;
-                       } else if(msg[i] < (char)0xE0) {
-                               msg[j] = '.';
+                       } else if(umsg[i] < (unsigned char)0xE0) {
+                               umsg[j] = '.';
                                i+=3;
-                       } else if(msg[i] < (char)0xF0) {
-                               msg[j] = '.';
+                       } else if(umsg[i] < (unsigned char)0xF0) {
+                               umsg[j] = '.';
                                i+=4;
                        }
                        j++;
                }
+               umsg[j]='\0';
 
                if(tm) {
                        char newmessage[2048];





reply via email to

[Prev in Thread] Current Thread [Next in Thread]