summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cfx_xmlelement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlelement.cpp')
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 42588c6393..c54d8488a3 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -93,30 +93,31 @@ void CFX_XMLElement::SetTextData(const WideString& wsText) {
AppendChild(new CFX_XMLText(wsText));
}
-void CFX_XMLElement::Save(
- const RetainPtr<CFX_SeekableStreamProxy>& pXMLStream) {
- pXMLStream->WriteString(L"<");
- pXMLStream->WriteString(name_.AsStringView());
+void CFX_XMLElement::Save(const RetainPtr<IFX_SeekableStream>& pXMLStream) {
+ ByteStringView name_encoded = name_.UTF8Encode().AsStringView();
+
+ pXMLStream->WriteString("<");
+ pXMLStream->WriteString(name_encoded);
for (auto it : attrs_) {
pXMLStream->WriteString(
- AttributeToString(it.first, it.second).AsStringView());
+ AttributeToString(it.first, it.second).UTF8Encode().AsStringView());
}
if (!GetFirstChild()) {
- pXMLStream->WriteString(L" />");
+ pXMLStream->WriteString(" />\n");
return;
}
- pXMLStream->WriteString(L">");
+ pXMLStream->WriteString(">\n");
for (CFX_XMLNode* pChild = GetFirstChild(); pChild;
pChild = pChild->GetNextSibling()) {
pChild->Save(pXMLStream);
}
- pXMLStream->WriteString(L"</");
- pXMLStream->WriteString(name_.AsStringView());
- pXMLStream->WriteString(L"\n>");
+ pXMLStream->WriteString("</");
+ pXMLStream->WriteString(name_encoded);
+ pXMLStream->WriteString(">\n");
}
CFX_XMLElement* CFX_XMLElement::GetFirstChildNamed(