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

Absence of (supported) codec handling in Qt6 / Stream/Text/ReaderWriter

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.0 (Next Major Release)
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      All

      Description

      My open-source project GPSBabel is negatively impacted by pending changes in Qt6. I'm hoping we can work this through before release.

      In loose terms, we're a file converter. We thus don't have a huge amount of control of the inputs and outputs needed. We may be reading a file that allows embedded form feeds and is encoded in Windows CP-1252 (ick) and need to write to an XML or TextStream that needs UTF-8 and that forbids control characters (even escaped) in the streams.setEncoding() is a poor substitute for setCodec() for us. 

      QtCore5Compat lets us still get to the codecs we use to override this, but we can't use them with QXmlStreamReader, QXmlStreamWriter, QTextStreamReader, or QTextStreamWriter and that's a problem for us. latin1 iso-8859-1 seems supported, but CP-1252, US-ASCII, UTF-16LE, and more are needs for us.

      In Qt5.11, there is a fix in QXmlStreamWriter that detects illegal characters in the output, but it just sets the error, makign it indistinguishable from an I/O error for us, and the doc leaves open that it may discard or damage anything written after that happens.  https://github.com/qt/qtbase/commit/3b5b8f1d4ab8092e5dd337b7b4e32d85fda2e0b7 was implicated This means if we write an invalid character, we can't distinguish it from a network or disk error.

      For these reasons, in Qt5 we'd installed our own codec to filter Bad Things like a Control-Z in our XML and we can longer do that. We have a lot of conversions we can just no longer do because we can't control the rich variety of codecs we once had. Beyond the invalid character cases that we'd filtered, we have a variety of issuus with formats using CP1252, 8859-X and UTF-16 that just no longer are available to us.

      Our working set of changes is visible at https://github.com/gpsbabel/gpsbabel/compare/master...tsteven4:qt6 - we have large regressions in the areas of codec support, currently marked with QT_VERSION_CHECK(6, 0, 0)

      Moving QTextCodec to a deprecated module is a Qt6 blocker for us. Any advice?

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            robertlipe Robert Lipe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes