Don't check for surrogates when verifying the chars to normalize

This commit is contained in:
calixteman 2026-02-26 16:46:34 +01:00
parent 3ae6cdc7c2
commit 881f9779e6
No known key found for this signature in database
GPG Key ID: 0C5442631EE0691F

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) {