]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
fix sys_specialcharactertranslation for utf-8 mode
[xonotic/darkplaces.git] / 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