From: Eric Pouech eric.pouech@gmail.com
They will be reinterpreted by Unix tty, leading to wrong display.
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- programs/conhost/conhost.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/programs/conhost/conhost.c b/programs/conhost/conhost.c index c3a106c9321..769f998f404 100644 --- a/programs/conhost/conhost.c +++ b/programs/conhost/conhost.c @@ -358,6 +358,8 @@ static void update_output( struct screen_buffer *screen_buffer, RECT *rect ) int x, y, size, trailing_spaces; char_info_t *ch; char buf[8]; + WCHAR wch; + const unsigned int mask = (1u << '\0') | (1u << '\b') | (1u << '\t') | (1u << '\n') | (1u << '\a') | (1u << '\r');
if (!is_active( screen_buffer ) || rect->top > rect->bottom || rect->right < rect->left) return; @@ -393,9 +395,11 @@ static void update_output( struct screen_buffer *screen_buffer, RECT *rect ) tty_write( screen_buffer->console, "\x1b[K", 3 ); break; } - + wch = ch->ch; + if (screen_buffer->console->is_unix && wch < L' ' && mask & (1u << wch)) + wch = L'?'; size = WideCharToMultiByte( get_tty_cp( screen_buffer->console ), 0, - &ch->ch, 1, buf, sizeof(buf), NULL, NULL ); + &wch, 1, buf, sizeof(buf), NULL, NULL ); tty_write( screen_buffer->console, buf, size ); screen_buffer->console->tty_cursor_x++; }