-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a ReadConsoleOutputCharacter regression #16898
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zadjii-msft
approved these changes
Mar 19, 2024
lhecker
force-pushed
the
dev/lhecker/16892-read-character
branch
from
March 19, 2024 17:26
5f51d50
to
a478a59
Compare
DHowett
requested changes
Mar 19, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping me when those TBA are filled in!
microsoft-github-policy-service
bot
added
the
Needs-Author-Feedback
The original author of the issue/PR needs to come back and respond to something
label
Mar 19, 2024
There's no inbox servicing to be done any longer, unless this is a P0. |
microsoft-github-policy-service
bot
removed
the
Needs-Author-Feedback
The original author of the issue/PR needs to come back and respond to something
label
Mar 19, 2024
@DHowett Should be good now. 🙂 I also added a feature test. |
This comment has been minimized.
This comment has been minimized.
DHowett
approved these changes
Mar 19, 2024
DHowett
approved these changes
Mar 20, 2024
DHowett
pushed a commit
that referenced
this pull request
Mar 20, 2024
The `nLength` parameter of `ReadConsoleOutputCharacterW` indicates the number of columns that should be read. For single-column (narrow) surrogate pairs this previously clipped a trailing character of the returned string. In the major Unicode support update in #13626 surrogate pairs truly got stored as atomic units for the first time. This now meant that a 120 column read with such codepoints resulted in 121 characters. Other parts of conhost still assume UCS2 however, and so this results in the entire read failing. This fixes the issue by turning surrogate pairs into U+FFFD which makes it UCS2 compatible. Closes #16892 * Write U+F15C0 and read it back with `ReadConsoleOutputCharacterW` * Read succeeds with a single U+FFFD ✅ (cherry picked from commit 373faf0) Service-Card-Id: 92121912 Service-Version: 1.20
DHowett
pushed a commit
that referenced
this pull request
Mar 20, 2024
The `nLength` parameter of `ReadConsoleOutputCharacterW` indicates the number of columns that should be read. For single-column (narrow) surrogate pairs this previously clipped a trailing character of the returned string. In the major Unicode support update in #13626 surrogate pairs truly got stored as atomic units for the first time. This now meant that a 120 column read with such codepoints resulted in 121 characters. Other parts of conhost still assume UCS2 however, and so this results in the entire read failing. This fixes the issue by turning surrogate pairs into U+FFFD which makes it UCS2 compatible. Closes #16892 * Write U+F15C0 and read it back with `ReadConsoleOutputCharacterW` * Read succeeds with a single U+FFFD ✅ (cherry picked from commit 373faf0) Service-Card-Id: 92129542 Service-Version: 1.19
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
nLength
parameter ofReadConsoleOutputCharacterW
indicatesthe number of columns that should be read. For single-column (narrow)
surrogate pairs this previously clipped a trailing character of the
returned string. In the major Unicode support update in #13626
surrogate pairs truly got stored as atomic units for the first time.
This now meant that a 120 column read with such codepoints resulted
in 121 characters. Other parts of conhost still assume UCS2 however,
and so this results in the entire read failing.
This fixes the issue by turning surrogate pairs into U+FFFD
which makes it UCS2 compatible.
Closes #16892
Validation Steps Performed
ReadConsoleOutputCharacterW