mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 08:38:06 +02:00
Fix copying on supplementary plane characters
pdf.js had a problem when copying characters on supplementary planes (0xPPXXXX where PP is nonzero). This is because certain methods of PartialEvaluator use classic String.fromCharCode instead of ES6's String.fromCodePoint. Despite the fact that readToUnicode method *tried* to parse out-of-UCS2 code points by parsing UTF-16BE, it was inadequate because String.fromCharCode only supports UCS-2 range of Unicode.
This commit is contained in:
parent
2b6e6364ef
commit
96ba6afd47
4 changed files with 10 additions and 2 deletions
|
@ -2045,7 +2045,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
toUnicode[charcode] = String.fromCharCode(code);
|
||||
toUnicode[charcode] = String.fromCodePoint(code);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -2179,7 +2179,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
var w2 = (token.charCodeAt(k) << 8) | token.charCodeAt(k + 1);
|
||||
str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
|
||||
}
|
||||
map[charCode] = String.fromCharCode.apply(String, str);
|
||||
map[charCode] = String.fromCodePoint.apply(String, str);
|
||||
});
|
||||
return new ToUnicodeMap(map);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue