]> sourceware.org Git - newlib-cygwin.git/commit
Cygwin: console: Handle Unicode surrogate pairs.
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 16 Nov 2021 10:26:10 +0000 (11:26 +0100)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Tue, 16 Nov 2021 14:20:43 +0000 (23:20 +0900)
commit782aac590af7f065877168848d5fbb20535bfcf9
tree279355d4cfe8c538e4ec7df1595d06dbc15bb2d3
parent076c85673981493ed41aa176518a5e86fc71a33f
Cygwin: console: Handle Unicode surrogate pairs.

When running Cygwin's Bash in the Windows Terminal (see
https://docs.microsoft.com/en-us/windows/terminal/ for details), Cygwin
is receiving keyboard input in the form of UTF-16 characters.

UTF-16 has that awkward challenge that it cannot map the full Unicode
range, and to make up for it, there are the ranges U+D800-U+DBFF and
U+DC00-U+DFFF which are illegal except when they come in a pair encoding
for Unicode characters beyond U+FFFF.

Cygwin does not handle such surrogate pairs correctly at the moment, as
can be seen e.g. when running Cygwin's Bash in the Windows Terminal and
then inserting an emoji (e.g. via Windows + <dot>, which opens an emoji
picker on recent Windows versions): Instead of showing an emoji, this
shows the infamous question mark in a black triangle, i.e. the invalid
Unicode character.

Let's special-case surrogate pairs in this scenario.

This fixes https://github.com/git-for-windows/git/issues/3281

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
winsup/cygwin/fhandler_console.cc
winsup/cygwin/release/3.3.3
This page took 0.032924 seconds and 5 git commands to generate.