mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-05 06:35:48 +02:00
Merge pull request #21526 from spokodev/w33/pdfjs-encodexml-surrogate
Do not drop the character after U+FFFE or U+FFFF in encodeToXmlString
This commit is contained in:
commit
9c46f48f88
@ -533,7 +533,7 @@ function encodeToXmlString(str) {
|
||||
buffer.push(str.substring(start, i));
|
||||
}
|
||||
buffer.push(`&#x${char.toString(16).toUpperCase()};`);
|
||||
if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
|
||||
if (char > 0xffff) {
|
||||
// char is represented by two u16
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -317,6 +317,11 @@ describe("core_utils", function () {
|
||||
const str = "hello world";
|
||||
expect(encodeToXmlString(str)).toEqual(str);
|
||||
});
|
||||
|
||||
it("should keep the character after U+FFFE or U+FFFF", function () {
|
||||
expect(encodeToXmlString("A")).toEqual("A");
|
||||
expect(encodeToXmlString("B")).toEqual("B");
|
||||
});
|
||||
});
|
||||
|
||||
describe("validateCSSFont", function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user