Improve unicode normalization#18803
Merged
Merged
Conversation
seanbudd
reviewed
Aug 26, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes Unicode normalization issues where combining diacritics were not pronounced correctly when bound to characters that don't result in normalization (like space + acute accent). The fix addresses both C++ offset calculation issues and Python logic for handling non-normalized character combinations.
Key changes:
- Fixed C++ character boundary calculation to include start offset (position 0)
- Updated Python logic to handle cases where normalization doesn't occur but character splitting is needed
- Added comprehensive unit tests for both the uniscribe splitting function and speech output
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| nvdaHelper/local/textUtils.cpp | Fixed character boundary calculation to include start position |
| source/textUtils/uniscribe.py | Corrected offset slicing to match C++ changes |
| source/speech/speech.py | Enhanced normalization logic to handle non-normalized character combinations |
| tests/unit/test_textUtils.py | Added comprehensive tests for character boundary splitting |
| tests/unit/test_speech.py | Added test for space+acute accent pronunciation behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
seanbudd
reviewed
Aug 27, 2025
seanbudd
approved these changes
Aug 27, 2025
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.
Link to issue number:
Fixes #18722, for real this time.
Summary of the issue:
#18722 wasn't yet fixed, i.e. combining diacritics were still not pronounced correctly when Unicode normalization is on.
Description of user facing changes:
Combining diacritics will no be correctly announced when bound to a character that doesn't result in normalization, such as space.
Description of developer facing changes:
None
Description of development approach:
For normalization per character, we use
textUtils.uniscribe.splitAtCharacterBoundariesto split per character and then perform per char normalization. However, combinations like\u0301(space + acute) are treated as one character, i.e. the acute binds to the preceding space. Normalization doesn't happen in this case, but yet the normalization logic changes the announcement behavior.This fixes two issues:
These cases are backed with unit tests to ensure the behavior is what we expect.
Testing strategy:
Unit tests
Known issues with pull request:
None
Code Review Checklist: