Unicode Problem on SFS2X Server with C++ Client Api

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

chamroeun
Posts: 10
Joined: 18 Feb 2016, 17:15

Unicode Problem on SFS2X Server with C++ Client Api

Postby chamroeun » 08 Mar 2016, 15:55

Hi,
I used C++ SFS2X Client Api.

When I sent params value of UNICODE STRING, the server show this Error:
Error deserializing request: java.nio.BufferUnderflowException

My client Code For Sending Data To server:

Code: Select all

boost::shared_ptr<ISFSObject> params (new SFSObject());
params->PutUtfString("test", ("helloសាកល្បង");
boost::shared_ptr<IRequest> request (new ExtensionRequest("cmi", params));
GameServer::getSingleton().getSmartFox()->Send(request);



------MY SERVER CODE-------

When I sent Unicode data from server to client, the client receive correct ascii value part, but incorrect unicode value

Code: Select all

ISFSObject notiparams = SFSObject.newInstance();
notiparams.putUtfString("notiMSG", "Welcome ... សាកល្បង");
this.send("notiRMFF", notiparams, user);



Client Code to receive data from server

Code: Select all

 boost::shared_ptr<string> cmdx = ((boost::static_pointer_cast<string>)(param->GetUtfString("notiMSG")));
    CCLog("Server Mess:%s",cmdx->c_str());




The client will correctly received "Welcome ..." but the unicode part is wrong (/303/302)

Any suggestion?

Thanks;
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unicode Problem on SFS2X Server with C++ Client Api

Postby Lapo » 09 Mar 2016, 08:51

Thanks for reporting. I have forwarded your request to our C++ expert.

Stay tuned.
Lapo
--
gotoAndPlay()
...addicted to flash games
chamroeun
Posts: 10
Joined: 18 Feb 2016, 17:15

Re: Unicode Problem on SFS2X Server with C++ Client Api

Postby chamroeun » 10 Mar 2016, 03:42

My problem solved!

It was due to the wrong version of client of the Sample C++ code which I downloaded from Smartfox C++ Sample section.

But it is really really hard to get Smartfox C++ client of new version and Cocos2dx to work on iOS, ranging from compiling boost, openssl, lib here and there...

And one more point, I have also to edit some cpp files in Smartfox to get it compiled in Xcode C++.

Thanks;
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unicode Problem on SFS2X Server with C++ Client Api

Postby Lapo » 10 Mar 2016, 09:51

I hear your pain :)
C++ is difficult in general and making a library compatible with dozens of different platforms ranging from PCs, to consoles, mobile phones, tablets etc... running different OSes is indeed a pain in the neck.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Google [Bot] and 65 guests