Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QT5/gSOAP = encoding problem
Qt 6.11 is out! See what's new in the release blog

[SOLVED] QT5/gSOAP = encoding problem

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    unmanner
    wrote on last edited by
    #1

    Hi all!

    I have problem encoding with gSOAP/QT5/Zend2/WSDL.

    My russian string in bytes presented as: "H81:0" !!!

    But gSOAP RECV.log shown that string is OK in server response!

    What are missing? All source core in utf-8, wsdl and sever part in utf-8 too.

    But MVS debugger shown that my sdt::string is "H81:0"! What are .... ?!

    NOTE: All English charsets are OK.
    NOTE2: setCodecForLocate does not give any effect.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      What does Qt have to do with your std::string coming out of gSOAP? How are you outputting the string?

      Show us the input, expected output, and some code otherwise we could spend a long time guessing.

      1 Reply Last reply
      0
      • U Offline
        U Offline
        unmanner
        wrote on last edited by
        #3

        Hi Chris!

        I just printout gSOAP *string *in QT program as:

        fprintf(stdout, "string: %d\n", result.return_->string.c_srt());
        OR
        qDebug() << "String" << result.return_->string.c_srt();
        OR
        textInput.setTest(result.return_->string.c_srt());

        Where result.return_->string have type std::string.

        And everywhere above I got "03>;>2>;" instead of "Заголовок".

        I also tried result.return_->string.toLocal8Bit() and other but I get "03>;>2>;" again and again..

        Please stop my nightmare, if it possible..

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on last edited by
          #4

          Try to ask on gSOAP support forum or on IRC channel... setCodecForLocate is for Qt strings only... In your case it has nothing to do with Qt.

          God is Real unless explicitly declared as Integer.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            ChrisW67
            wrote on last edited by
            #5

            Your example string "Заголовок" when UTF-8 encoded is a series of bytes with the following hex values:
            D0 97 D0 B0 D0 B3 D0 BE D0 BB D0 BE D0 B2 D0 BE D0 BA
            with two bytes per character in this case. You can check this by "dumping the std::string in hex":http://stackoverflow.com/questions/5990825/convert-an-ascii-stdstring-to-hex.

            If you printf() that to a console configured for the Windows 1251 (or other 8-bit encoding), which tries to treat each byte as a character, you will get garbled output.

            To convert your std::string/C-string containing a UTF-8 encoded value into a QString you should try:
            @
            std::string s1;
            QString value2 = QString::fromUtf8(s1.c_str());
            // or
            char *s2;
            QString value2 = QString::fromUtf8(s2);
            @

            1 Reply Last reply
            0
            • U Offline
              U Offline
              unmanner
              wrote on last edited by
              #6

              [quote author="AcerExtensa" date="1365145609"]Try to ask on gSOAP support forum or on IRC channel... setCodecForLocate is for Qt strings only... In your case it has nothing to do with Qt.[/quote]

              Thank you!
              'soap_init1(&soap_object, SOAP_C_UTFSTRING);' should be used for UTF-8 strings, without any affect of QT standart application.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved