Cygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars

So far we printed a half filled square (0x2592) if the input char is
invalid, but using REPLACEMENT CHARACTER (0xfffd) is apparently the way
to go.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2018-09-01 21:34:34 +02:00
parent 3a880bf5e0
commit d1454de7b0
1 changed files with 3 additions and 4 deletions

View File

@ -1971,13 +1971,12 @@ bad_escape:
}
}
/* This gets called when we found an invalid input character. We just
print a half filled square (UTF 0x2592). We have no chance to figure
out the "meaning" of the input char anyway. */
/* This gets called when we found an invalid input character.
Print Unicode REPLACEMENT CHARACTER (UTF 0xfffd). */
inline void
fhandler_console::write_replacement_char ()
{
static const wchar_t replacement_char = 0x2592; /* Half filled square */
static const wchar_t replacement_char = 0xfffd; /* REPLACEMENT CHARACTER */
DWORD done;
WriteConsoleW (get_output_handle (), &replacement_char, 1, &done, 0);
}