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

Inconsistent encoding of string literals

    XMLWordPrintable

    Details

    • Story Points:
      13
    • Sprint:
      Qt6_Foundation_Sprint 17

      Description

      With the beginning of Qt5 string literals are assumed to be utf8 encoded (see the QString constructor from const char *). So I have converted my sourcecode to utf8.

      But yet I get the wrong output if I print a string literal onto a QTextStream. The QTextStream output operator interprets const char * always as ISO-8859-1 encoded (see documentation). This is inconsistent. I have to encode string literals as utf8 if I use them to initialize a QString and as latin1 if I use them for output.

      I also cannot change the output-operator of QTextStream because it is not virtual. The only solution is to convert every string explicitly into a QString via QString::fromUtf8. (I have to do this for thousends of strings).

      Please use the same encoding for string literals in QString and QTextStream or add a method to change the default for QTextStream.

        Attachments

        For Gerrit Dashboard: QTBUG-54942
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            laknoll Lars Knoll
            Reporter:
            rsprengel Rainer Sprengel
            PM Owner:
            Maurice Kalinowski Maurice Kalinowski
            RnD Owner:
            Alex Blasche Alex Blasche
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes