Skip to content

Commit 2bab2a8

Browse files
Merge pull request #20745 from calixteman/issue20744
Don't check for surrogates when verifying the chars to normalize
2 parents 3ae6cdc + 881f977 commit 2bab2a8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

web/pdf_find_utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ function getNormalizeWithNFKC() {
140140
const diacriticsRegex = /^\p{M}$/u;
141141
// Some chars must be replaced by their NFKC counterpart during a search.
142142
for (let i = 0; i < 65536; i++) {
143+
if (i >= 0xd800 && i <= 0xdfff) {
144+
continue; // Skip surrogates since they're not valid Unicode scalar values.
145+
}
143146
const c = String.fromCharCode(i);
144147
if (c.normalize("NFKC") !== c && !diacriticsRegex.test(c)) {
145148
if (range.length !== 2) {

0 commit comments

Comments
 (0)