Issue with coding in QString
Hello
I am facing with some issue and I don't have any idea how to fix that..
Generally, I want to use FIX API and the format should be like below:
Quote:
"8=FIX.4.4|9=124|35=A|49=broker.1111111|56=ser ver"
I noticed that it does not work in this format, but it works when I changed | sign to . Weird, but I think it is connected somehow with unicode coding...
In that that it was good and it worked.
Unfortunately, since some time, (I don't know why) the connection with the API does not work, because I noticed, the sent message does not look like:
Quote:
"8=FIX.4.49=12435=A49=broker.111111156=ser ver"
..but it looks:
Quote:
Sending... "8=FIX.4.4\u00019=124\u000135=A\u000149=broker.111 1111\u000156=server
The sending code is below.
Code:
QString refMsg2
= "8=FIX.4.4|9=124|35=A|49=broker.1111111|56=server";
refMsg2.replace("|", "");
qDebug() << "Sending... " << refMsg2;
socket->write(refMsg2.toStdString().c_str());
The Question is: do you know whe I see "\u0001" now?
I think it does not work (there is no response from API) because write method of socket takes const char* argument and it changes something (there must be casting to stdString and call of c_str method)?
Do you have any ideas?
Thanks in advance!
Regards,
?ukasz
Re: Issue with coding in QString
Quote:
Originally Posted by
luk_man_
The sending code is below.
Code:
QString refMsg2
= "8=FIX.4.4|9=124|35=A|49=broker.1111111|56=server";
refMsg2.replace("|", "");
qDebug() << "Sending... " << refMsg2;
socket->write(refMsg2.toStdString().c_str());
The Question is: do you know whe I see "\u0001" now?
The \u0001 is there because you have (somehow) typed the non-printable Control-A in the replacement string in line 2. Retype line 2.
Edit: On my machine the non-printable character became visible in the forum's advanced editor preview as a small, square placeholder character with 00 01 in it. YMMV