From 3f4090ac3880ae0bce5b5834f8519a511856c6d6 Mon Sep 17 00:00:00 2001 From: Bart House Date: Thu, 15 Nov 2018 21:42:23 -0800 Subject: [PATCH] Remap unicode control codes. When running NetHack.exe in a console set to code page 850, the multi-byte to wide character mapping will generate unicode values in the unicode control code range. These values need to be re-mapped to unicode renderable glyphs using the same mappings we use for control page 437 otherwise the console font might not render a character for these unicode control values. --- sys/winnt/nttty.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/winnt/nttty.c b/sys/winnt/nttty.c index ead199341..177426ee1 100644 --- a/sys/winnt/nttty.c +++ b/sys/winnt/nttty.c @@ -1664,6 +1664,12 @@ void set_cp_map() int count = MultiByteToWideChar(codePage, 0, &c, 1, &console.cpMap[i], 1); nhassert(count == 1); + + // If a character was mapped to unicode control codes, + // remap to the appropriate unicode character per our + // code page 437 mappings. + if (console.cpMap[i] < 32) + console.cpMap[i] = cp437[console.cpMap[i]]; } }