On Friday, August 09, 2013 13:21:45 James Turner wrote:
> Qt sockets are very thin wrappers around BSD / Windows sockets. More likely
> to be a character set / encoding issue? Remember you need to be explicit
> about encoding when going from 8-bit representation to a QString.
>
> That said I've no experience with the FG telnet code. If you want to post
> your client code I'm happy to quickly look at it.
>
> James.
Hi James,
You're quite correct, I also think it's an encoding issue. Qt 4.8 had a
toAscii() translation, while Qt 5.1 has got rid of that and supposedly it's
functionality is enclosed in toLatin1().
Basically I've reached a state where out of ideas I'm just reading the
response one char after another, then appending it to a QString.
QString line;
while(!_socket->canReadLine()){}
...snip...
while ((!endOfLine)) {
char c;
int bytesRead = _socket->read(&c, sizeof(c));
...snip...
line.append( c );
Then after testing for a '\r' char which signals the end of line, I'm
returning the QString to it's user.
I have to use a blocking approach due to the already existing structure, but
it's not a problem, since this is on it's own thread. I think the encoding is
the problem here, but I don't have a clue why the Python wrapper does it right
while Qt doesn't.
Cheers,
Adrian
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel