]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix sys_specialcharactertranslation for utf-8 mode
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Dec 2010 20:50:15 +0000 (20:50 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 12 Dec 2010 20:50:15 +0000 (20:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10658 d7cf8633-e32d-0410-b094-e92efae38249

console.c

index 0eaccd3efb4a43914d6eb5342a973e57a08d4c19..8a3fa90f86ba00af4bf90c3e1e140e3224cb5ace 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1115,11 +1115,24 @@ void Con_MaskPrint(int additionalmask, const char *msg)
                        // send to terminal or dedicated server window
                        if (!sys_nostdout)
                        {
-                               unsigned char *p;
                                if(sys_specialcharactertranslation.integer)
                                {
-                                       for (p = (unsigned char *) line;*p; p++)
-                                               *p = qfont_table[*p];
+                                       char *p;
+                                       const char *q;
+                                       p = line;
+                                       while(*p)
+                                       {
+                                               int ch = u8_getchar(p, &q);
+                                               if(ch >= 0xE000 && ch <= 0xE0FF)
+                                               {
+                                                       *p = qfont_table[ch - 0xE000];
+                                                       if(q > p+1)
+                                                               memmove(p+1, q, strlen(q));
+                                                       p = p + 1;
+                                               }
+                                               else
+                                                       p = p + (q - p);
+                                       }
                                }
 
                                if(sys_colortranslation.integer == 1) // ANSI