This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Older versions of the Objective C library would occasionally create patches from invalid separations of the surrogate pairs. It would start by finding the longest common prefix which split a surrogate pair in half when inserting in between existing surrogates sharing the same high surrogate: `\ud83c\udd70\ud83c\udd71` -> `\ud83c\udd70\ud83c\udd72\ud83c\udd71` `\ud83c\udd70\ud83c` + `\udd72\ud83c` + `\udd71` Next it would try to create diff groups from these and fail because of the unpaired surrogates. The middle group is entirely wrong and gets replaced with `(null)` while the other surrogate halves stick around _as counts_ since that's how `toDelta()` converts them. `=3\t+(null)\t=1` When the libraries receive this patch they end up reconstructing an invalid Unicode sequence because of the numbers which now instruct it to split those same surrogate pairs. --- In this patch we're identifying this specific sequence in `fromDelta()` and removing the additional breakage by eliminating the `(null)` group and re-joining the split surrogate halves. You can see that this will effectively undo the change operation because that `(null)` is where the new character was inserted. _There is no way to avoid this_ as the problem occurred in the past and we have lost information to `(null)`. In this patch we are merely removing the vestige of a failure that would lead to additional failures if we passed on the data.
- Loading branch information
Showing
11 changed files
with
188 additions
and
65 deletions.
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.