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

QWebEngineView::setContent(data,mimeType) does not respect html charset information

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.10.0 Alpha
    • 5.6.0 Beta
    • WebEngine
    • None

      When using setContent() to set the content of a QWebEngineView umlauts are not displayed correctly, i.e. the content is interpreted as iso8859-1 or event plain text:

      The problems occur with the following html document:
      <html>
      <head><meta http-equiv="Content-type" content="text/html; charset=utf-8"></head>
      <body>Umlauts are here: äöü.</body>
      </html>

      The html is passed to setContent as utf8 bytearray:

      webView->setContent(htmlAsUtf7, mimeType);

      Depending on the content of the mimetype parameter, different results are observed:
      1. mimeType is "text/html": The content is displayed as HTML, umlauts are interpreted in iso8859-1
      2. mimeType is "text/html; charset=utf-8": The content display as HTML, umlauts are displayed correctly
      3. mimeType is passed empty: No auto detected seems to occur, the document is displayed as plain text.

      I consider
      1) a bug since the HTML contains a charset directive
      2) not sure whether the mimetype parameter should overwrite the html content charset information
      3) a bug since it should at least assume "text/html" and not text/plain

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

            jbornema Joerg Bornemann
            hrabowski Maximilian Hrabowski
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes