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

The display breaks if you specify Japanese callback text

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9.0 Beta 2
    • 5.8.0
    • None
    • macOS 10.12.3(16D32)Clang 7.0 (Apple), 64 bit
    • 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

            jefernan Jesus Fernandez
            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