Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6930217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:25:07+00:00 2026-05-27T11:25:07+00:00

My team and I have this nasty problem with parsing a string received from

  • 0

My team and I have this nasty problem with parsing a string received from our server. The server is pretty simple socket stuff done in qt here is the sendData function:

void sendData(QTcpSocket *client,QString response){
QString text = response.toUtf8();
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out << (quint32)0;
out << text;
out.device()->seek(0);
out << (quint32)(block.size() - sizeof(quint32));
try{
    client->write(block);
}
catch(...){...

The client is in Java and is also pretty standard socket stuff, here is where we are at now after trying many many different ways of decoding the response from the server:

Socket s;
try {
    s = new Socket(URL, 1987);

    PrintWriter output = new PrintWriter(s.getOutputStream(), true);
    InputStreamReader inp = new InputStreamReader(s.getInputStream(), Charset.forName("UTF-8"));
    BufferedReader rd = new BufferedReader( inp );

    String st;
    while ((st = rd.readLine()) != null){
        System.out.println(st);
    }...

If a connection is made with the server it sends a string “Send Handshake” with the size of the string in bytes sent before it as seen in the first block of code. This notifies the client that it should send authentication to the server. As of now the string we get from the server looks like this:
������ ��������S��e��n��d�� ��H��a��n��d��s��h��a��k��e

We have used tools such as string encode/decode tool to try and assess how the string is encoded but it fails on every configuration.

We are out of ideas as to what encoding this is, if any, or how to fix it.
Any help would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:25:08+00:00Added an answer on May 27, 2026 at 11:25 am

    At a glance, the line where you convert the QString parameter to a Utf8 QByteArray and then back to a QString seems odd:

    QString text = response.toUtf8();
    

    When the QByteArray returned by toUtf8() is assigned to text, I think it is assumed that the QByteArray contains an Ascii (char*) buffer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this GUI screen shots from the design team which i needs to
This is a weird problem I have started having recently. My team is developing
i have this problem to my wordpress theme but team points its with Custom
I do not mean English. Just communication. I have this problem in my team
I have this simple query -> var games = from p in _oListGames where
Much related to this question , we have a scenario on my team where
We (small team) currently have our Visual Studio projects on a network drive (no
In our team we have a database project in visual Studio 2008 which is
I currently have this class that another programmer in my team coded: public static
I have a problem that I am unable to resolve. My development team have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.