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

The display breaks if you specify Japanese callback text

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.8.0
    • Fix Version/s: 5.9.0 Beta 2
    • Labels:
      None
    • Environment:
      macOS 10.12.3(16D32)Clang 7.0 (Apple), 64 bit
    • Commits:
      decac344458ddd45ec8f03d721d40795c7095404

      Description

      About the QOAuthHttpServerReplyHandler class specified in QOAuth1::setReplyHandler().

      QOAuthHttpServerReplyHandler::setCallbackText() should be able to specify the contents of the response after the callback.

      But, if you specify a Japanese text encoded in UTF-8 for this method, the display will be corrupted.

      Probably, This is the same when one character uses characters composed of multiple bytes.

      Default response is:

      <html><head><title>Jugemutter</title></head><body>Callback received. Feel free to close this page.</body></html>
      

      Code that causes problems:

      auto *httpReplyHandler = new QOAuthHttpServerReplyHandler(this);
      httpReplyHandler->setCallbackText(”あ”);
      

      That is response is (The last letter has been deleted):

      <html><head><title>Jugemutter</title></head><body>あ</body></htm
      

      Probably, caused by the following code:

      src/qoauthhttpserverreplyhandler.cpp QOAuthHttpServerReplyHandlerPrivate::_q_answerClient()
              const QByteArray htmlSize = QString::number(html.size()).toUtf8();
      

      html.size() is number of characters, but correct is number of bytes.

        Attachments

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

          Activity

            People

            • Assignee:
              jefernan Jesus Fernandez
              Reporter:
              sharkpp sharkpp
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes