mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
XFA - Encode tag names in UTF-8 when saving (fix #14249)
This commit is contained in:
parent
891f21fba6
commit
13ae6d493a
2 changed files with 9 additions and 5 deletions
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
import { getInteger, getKeyword, HTMLResult } from "./utils.js";
|
||||
import { shadow, warn } from "../../shared/util.js";
|
||||
import { shadow, utf8StringToString, warn } from "../../shared/util.js";
|
||||
import { encodeToXmlString } from "../core_utils.js";
|
||||
import { NamespaceIds } from "./namespaces.js";
|
||||
import { searchNode } from "./som.js";
|
||||
|
@ -819,10 +819,12 @@ class XmlObject extends XFAObject {
|
|||
buf.push(encodeToXmlString(this[$content]));
|
||||
return;
|
||||
}
|
||||
const utf8TagName = utf8StringToString(tagName);
|
||||
const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
|
||||
buf.push(`<${prefix}${tagName}`);
|
||||
buf.push(`<${prefix}${utf8TagName}`);
|
||||
for (const [name, value] of this[_attributes].entries()) {
|
||||
buf.push(` ${name}="${encodeToXmlString(value[$content])}"`);
|
||||
const utf8Name = utf8StringToString(name);
|
||||
buf.push(` ${utf8Name}="${encodeToXmlString(value[$content])}"`);
|
||||
}
|
||||
if (this[_dataValue] !== null) {
|
||||
if (this[_dataValue]) {
|
||||
|
@ -848,7 +850,7 @@ class XmlObject extends XFAObject {
|
|||
child[$toString](buf);
|
||||
}
|
||||
}
|
||||
buf.push(`</${prefix}${tagName}>`);
|
||||
buf.push(`</${prefix}${utf8TagName}>`);
|
||||
}
|
||||
|
||||
[$onChild](child) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue