Fix handling of surrogate pairs in length calculation#4462
Open
totkeks wants to merge 4 commits intoPowerShell:masterfrom
Open
Fix handling of surrogate pairs in length calculation#4462totkeks wants to merge 4 commits intoPowerShell:masterfrom
totkeks wants to merge 4 commits intoPowerShell:masterfrom
Conversation
Author
|
@microsoft-github-policy-service agree |
Contributor
|
I think this pull request needs a unit-test to demonstrate the requirements, but a couple unit tests would be nice. |
Member
|
Oh I'm so sorry, we should've gotten to this sooner. Looks like the correct fix the identified bug to me. |
I reviewed and they seem to correctly cover the reported (and solved) issues with glyphs / surrogate pairs.
Member
|
Hey @totkeks I merged the main branch in (it's sadly still called "master") and added some Claude generated unit tests which looked correct to me. Can you take a look and confirm the assertions are covering the bugfix? |
And short circuits faster if at end of the string.
andyleejordan
approved these changes
Apr 1, 2026
Member
andyleejordan
left a comment
There was a problem hiding this comment.
Looks good to me. @daxian-dbw?
This file contains hidden or 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
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.
PR Summary
Adds new conditions to handle surrogate pairs when calculating the buffer length of a string.
Fixes #3857.
PR Checklist
Microsoft Reviewers: Open in CodeFlow