Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-122466

QTextDocument exports unescaped control characters to HTML

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.10, 6.6.0
    • GUI: Text handling
    • None
    • Linux/X11

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            alexey.rusakov Alexey Rusakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes