mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 08:27:19 +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(str.substring(start, i));
|
||||||
}
|
}
|
||||||
buffer.push(`&#x${char.toString(16).toUpperCase()};`);
|
buffer.push(`&#x${char.toString(16).toUpperCase()};`);
|
||||||
if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
|
if (char > 0xffff) {
|
||||||
// char is represented by two u16
|
// char is represented by two u16
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,6 +317,11 @@ describe("core_utils", function () {
|
|||||||
const str = "hello world";
|
const str = "hello world";
|
||||||
expect(encodeToXmlString(str)).toEqual(str);
|
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 () {
|
describe("validateCSSFont", function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user