Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.10, 6.6.0
-
None
Description
The following code leads to a control character being exported from a `QTextDocument` as-is, which doesn't seem to comply with what W3C says, see https://www.w3.org/International/questions/qa-controls.
#include <QTextDocument>
void main() {
QGuiApplication app;
QTextDocument doc(QStringLiteral("\x1b")); // ESC character
auto html = doc.toHtml();
Q_ASSERT(html.indexOf('\x1b') == -1); // Will fail
}
To be honest, I don't know what should be the right course of action here, since toHtml() returns HTML 4.0, which doesn't support control characters at all. Perhaps I would expect stripping them away or at least (even if that's still not quite correct) turn them to `` etc.