This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Cygwin: console: Print Unicode REPLACEMENT CHARACTER for invalid input chars


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d1454de7b03c93556c33c33c5fd8db288ab4feac

commit d1454de7b03c93556c33c33c5fd8db288ab4feac
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Sat Sep 1 21:34:34 2018 +0200

    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>

Diff:
---
 winsup/cygwin/fhandler_console.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 2a978e7..9a6c9b1 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -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);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]