From 17cf7e1017bb268d2de0f577f5b2876038f23b99 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 12 Dec 2010 20:50:15 +0000 Subject: [PATCH] fix sys_specialcharactertranslation for utf-8 mode git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10658 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=1b1a05b13477696088ac74f71a0fdb1277db4f49 --- console.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/console.c b/console.c index 0eaccd3e..8a3fa90f 100644 --- 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 -- 2.39.2