Surrogate pair that produces a half-with character erroneously rendered as full with #14055

Closed
opened 2026-01-31 03:59:32 +00:00 by claunia · 3 comments
Owner

Originally created by @alabuzhev on GitHub (May 30, 2021).

Windows Terminal version (or Windows build number)

Terminal Preview 1.8.1032.0; Windows 10.0.19041.985

Other Software

No response

Steps to reproduce

  • Download this text file: width_test.txt
  • Open Windows Terminal
  • Open a new Command Prompt tab (Ctrl+Shift+2)
  • chcp 65001
  • type <Insert path to your downloads folder here>\width_test.txt
  • Have a look at the results
  • Repeat the steps above in Windows Console.

Expected Behavior

The output should contain the following letters, enclosed in square brackets, with and without colour, aligned nicely in both cases:

A - U+0041, single wchar_t, half width
Щ - U+0449, single wchar_t, half width
字 - U+5B57, single wchar_t, full width
𠜎 - U+2070E, surrogate pair, full width
🄀 - U+1F100, surrogate pair, half width

Example (photoshopped):
image

Actual Behavior

Windows Terminal:

image

  • Without esc sequences the text looks good
  • With esc sequences the presence of a half width surrogate pair 🄀 (U+1F100) breaks the logic and shifts the rest of the text right, leaving a gap.

In Windows Console it's the same in both cases:

image

  • The with is wrong, but at least it's consistent and without gaps.

Same file in Notepad with the same font (Consolas):

image

Originally created by @alabuzhev on GitHub (May 30, 2021). ### Windows Terminal version (or Windows build number) Terminal Preview 1.8.1032.0; Windows 10.0.19041.985 ### Other Software _No response_ ### Steps to reproduce - Download this text file: [width_test.txt](https://github.com/microsoft/terminal/files/6566035/width_test.txt) - Open Windows Terminal - Open a new Command Prompt tab (Ctrl+Shift+2) - `chcp 65001` - `type <Insert path to your downloads folder here>\width_test.txt` - Have a look at the results - Repeat the steps above in Windows Console. ### Expected Behavior The output should contain the following letters, enclosed in square brackets, with and without colour, aligned nicely in both cases: `A` - [U+0041](https://www.fileformat.info/info/unicode/char/41/index.htm), single wchar_t, half width `Щ` - [U+0449](https://www.fileformat.info/info/unicode/char/0449/index.htm), single wchar_t, half width `字` - [U+5B57](https://www.fileformat.info/info/unicode/char/5b57/index.htm), single wchar_t, full width `𠜎` - [U+2070E](https://www.fileformat.info/info/unicode/char/2070e/index.htm), surrogate pair, full width `🄀` - [U+1F100](https://www.fileformat.info/info/unicode/char/1f100/index.htm), surrogate pair, half width Example (photoshopped): ![image](https://user-images.githubusercontent.com/11453922/120100567-4c293e00-c139-11eb-914f-7efb919b5c83.png) ### Actual Behavior Windows Terminal: ![image](https://user-images.githubusercontent.com/11453922/120100573-521f1f00-c139-11eb-9d80-71136849a8cd.png) - Without esc sequences the text looks good - With esc sequences the presence of a half width surrogate pair `🄀` (U+1F100) breaks the logic and shifts the rest of the text right, leaving a gap. -------------- In Windows Console it's the same in both cases: ![image](https://user-images.githubusercontent.com/11453922/120101303-67964800-c13d-11eb-98a6-0efec5a0e004.png) - The with is wrong, but at least it's consistent and without gaps. Same file in Notepad with the same font (Consolas): ![image](https://user-images.githubusercontent.com/11453922/120101455-1d619680-c13e-11eb-94ca-deb355434734.png)
claunia added the Resolution-Duplicate label 2026-01-31 03:59:32 +00:00
Author
Owner

@DHowett commented on GitHub (Jun 1, 2021):

Thanks for the report! Yeah -- this isn't good. We're tracking handling surrogate pairs better in #8000.

Right now, each code unit is given its own column (oops) even when the glyph only requires one.

@DHowett commented on GitHub (Jun 1, 2021): Thanks for the report! Yeah -- this isn't good. We're tracking handling surrogate pairs better in #8000. Right now, each code unit is given its own column (oops) even when the glyph only requires one.
Author
Owner

@DHowett commented on GitHub (Jun 1, 2021):

/dup #8000

@DHowett commented on GitHub (Jun 1, 2021): /dup #8000
Author
Owner

@ghost commented on GitHub (Jun 1, 2021):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jun 1, 2021): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14055