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

Do not replace nbsp characters when creating text/plain mime data

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.4.0 Beta1
    • 6.2.2
    • GUI: Drag and Drop
    • None
    • 17eb0f2d8a (qt/qtbase/dev) 17eb0f2d8a (qt/tqtc-qtbase/dev)

      When copying from a QTextEdit with a non-breaking space character (nbsp,
      U+00A0), the character will be replaced by an ordinary whitespace in the "text/plain" mime data.

      This is different from other native text editors, at least on Windows; they preserve the character. It also creates an asymetry, because pasting such a character from another plain text editor works fine.

      The reason for this behavior is that the default QTextEdit uses QTextDocumentFragment::toPlainText(), which in turn uses QTextDocument::toPlainText(). The latter one is documented to replace U+00A0, U+2029, and U+2028 characters.

      A possible fix is to switch to QTextDocument::toRawText(), which avoids these conversions.

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

            kkohne Kai Köhne
            kkohne Kai Köhne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes