Merge pull request #20745 from calixteman/issue20744

Don't check for surrogates when verifying the chars to normalize
This commit is contained in:
Jonas Jenwald 2026-02-26 19:08:02 +01:00 committed by GitHub
commit 2bab2a87a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,6 +140,9 @@ function getNormalizeWithNFKC() {
const diacriticsRegex = /^\p{M}$/u;
// Some chars must be replaced by their NFKC counterpart during a search.
for (let i = 0; i < 65536; i++) {
if (i >= 0xd800 && i <= 0xdfff) {
continue; // Skip surrogates since they're not valid Unicode scalar values.
}
const c = String.fromCharCode(i);
if (c.normalize("NFKC") !== c && !diacriticsRegex.test(c)) {
if (range.length !== 2) {