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

Q3TextDrag: failed HTML encode resolving when "meta http-equiv" tag isn't in a first tag of the document

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.0
    • None
    • Windows, X11.

      Q3TextDrag::decode(const QMimeSource*, QString&, QString&) function uses static QTextCodec *codecForHTML(const QByteArray &), in which "pos" variable, pointing to char in "ba", replaced by position of char in substring "str". When charset is found, to "cs" put substring from start of document instead of substring from "str".

      Possible solves:

      1)
      685c685
      < codec = codecForHTML(e->encodedData(mime));

      > codec = QTextCodec::codecForHtml(e->encodedData(mime));

      2)
      585,588c585,588
      < pos = str.indexOf(QLatin1String("charset="), 0, Qt::CaseInsensitive) + int(strlen("charset="));
      < if (pos != -1) {
      < int pos2 = ba.indexOf('\"', pos+1);
      < QByteArray cs = ba.mid(pos, pos2-pos);

      > int pos1 = str.indexOf(QLatin1String("charset="), 0, Qt::CaseInsensitive) + int(strlen("charset="));
      > if (pos1 != -1) {
      > int pos2 = ba.indexOf('\"', pos+pos1+1);
      > QByteArray cs = ba.mid(pos+pos1, pos2-pos-pos1);

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

            sorvig Morten Sørvig
            afalin Arseniy Ankudinov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes