Commit a538154e authored by Matus Uzak's avatar Matus Uzak

KoXmlWriter - don't add control codes not accepted in XML 1.0 documents.

REVIEW:104288
parent 60afc406
......@@ -130,7 +130,7 @@ void KoXmlWriter::startElement(const char* tagName, bool indentInside)
// Tell parent that it has children
bool parentIndent = prepareForChild();
d->tags.push(Tag(tagName, parentIndent && indentInside));
writeChar('<');
writeCString(tagName);
......@@ -342,9 +342,20 @@ char* KoXmlWriter::escapeForXML(const char* source, int length = -1) const
case 0:
*destination = '\0';
return output;
default:
// Control codes accepted in XML 1.0 documents.
case 9:
case 10:
case 13:
*destination++ = *src++;
continue;
default:
// Don't add control codes not accepted in XML 1.0 documents.
if (*src > 0 && *src < 32) {
++src;
} else {
*destination++ = *src++;
}
continue;
}
++src;
}
......@@ -483,7 +494,7 @@ void KoXmlWriter::addTextSpan(const QString& text, const QMap<int, int>& tabCach
endElement();
break;
// gracefully handle \f form feed in text input.
// otherwise the xml will not be valid.
// otherwise the xml will not be valid.
// \f can be added e.g. in ascii import filter.
case '\f':
case '\n':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment