Quantcast
Channel: Chilkat Forum - latest questions
Viewing all articles
Browse latest Browse all 1061

C++ socket, utf-32 encoding the same as utf-32be encoding

$
0
0

Here is my sample code:

int main( int argc, char* argv[] ) {

    CkSocket sock;
    bool success;
    success = sock.UnlockComponent( "Anything for 30-day trial" );
    if (success != true) {
        std::cout << sock.lastErrorText() << "\r\n";
        return 1;
    }

    success = sock.Connect("localhost", 23, false, 20000);
    Sleep( 1000 );
    sock.put_StringCharset( "ansi" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
    sock.put_StringCharset( "utf-8" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
    sock.put_StringCharset( "unicode" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
    sock.put_StringCharset( "unicodefffe" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
    sock.put_StringCharset( "ansi" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
    sock.put_StringCharset( "utf-32" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
    sock.put_StringCharset( "utf-32be" );
    sock.SendString( "abcd" );
    Sleep( 1000 );
}

The messages received by the server (running echotool.exe from https://github.com/PavelBansky/EchoTool) are

Client 127.0.0.1:54760 accepted at 4:07:08 PM
4:07:09 PM received [abcd]
4:07:10 PM received [abcd]
4:07:11 PM received [a b c d ]
4:07:12 PM received [ a b c d]
4:07:13 PM received [abcd]
4:07:14 PM received [a   b   c   d   ]
4:07:15 PM received [a   b   c   d   ]

These all look fine, except the last two are the same. The last one (utf-32be) should be

[   a   b   c   d]

I'm using I'm using v9.5.0.66 (x86-vc12) from 2/2/2017 to test.


Viewing all articles
Browse latest Browse all 1061

Trending Articles