X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/dc3c8261f1530c7926d4fded06a7ee58ec010b73..2c23c16ab03df465bfabe49ff396f5e65a8f09c0:/unicode.c diff --git a/unicode.c b/unicode.c index c3e10519..8dfe1d15 100644 --- a/unicode.c +++ b/unicode.c @@ -420,14 +420,14 @@ void init_ucs_tables(void) static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr) { - int i, j, k; - for (k = 0; k < 256; k++) { - i = ((k + 32) & 0xFF); - if (DIRECT_FONT(line_tbl[i])) + int font_index, line_index, i; + for (line_index = 0; line_index < 256; line_index++) { + if (DIRECT_FONT(line_tbl[line_index])) continue; - for (j = 0; j < 256; j++) { - if (line_tbl[i] == font_tbl[j]) { - line_tbl[i] = (WCHAR) (attr + j); + for(i = 0; i < 256; i++) { + font_index = ((32 + i) & 0xFF); + if (line_tbl[line_index] == font_tbl[font_index]) { + line_tbl[line_index] = (WCHAR) (attr + font_index); break; } } @@ -474,6 +474,9 @@ void luni_send(wchar_t * widebuf, int len) /* UTF is a simple algorithm */ for (p = linebuffer, i = 0; i < len; i++) { wchar_t ch = widebuf[i]; + /* Windows wchar_t is UTF-16 */ + if ((ch&0xF800) == 0xD800) ch = '.'; + if (ch < 0x80) { *p++ = (char) (ch); } else if (ch < 0x800) {