putUtfString strips characters from string

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

Post Reply
croftie
Posts: 49
Joined: 24 Jul 2013, 08:35
Location: Algarve Portugal
Contact:

putUtfString strips characters from string

Post by croftie »

When I try to add the text string of a json to an SFSObject, the curly braces are stripped from both ends. How can I send a stringified json (actually the value of a textarea) from html5 client to server?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: putUtfString strips characters from string

Post by Lapo »

Hi,
I am not sure I am getting this right: you're expecting JSON code to be input in the text area and you want to send that text representing the JSON?
Is it correct?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
croftie
Posts: 49
Joined: 24 Jul 2013, 08:35
Location: Algarve Portugal
Contact:

Re: putUtfString strips characters from string

Post by croftie »

Someone will paste the text of a json into a textarea and the value of that textarea is sent to the server. I have checked and the value of the text area is extracted correctly but .putUtfString into an object strips the curly braces.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: putUtfString strips characters from string

Post by Lapo »

How did you verify that the curly braces are lost in the SFSObject string?
Did you send the SFSObject to the server?
Lapo
--
gotoAndPlay()
...addicted to flash games
croftie
Posts: 49
Joined: 24 Jul 2013, 08:35
Location: Algarve Portugal
Contact:

Re: putUtfString strips characters from string

Post by croftie »

I did a console.log(sParams.getDump()) before sending to server
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: putUtfString strips characters from string

Post by Lapo »

I imagined that.
The getDump() method uses curly braces internally as tokens to format the data, and that's the reason why the output doesn't match the expectations. But the data is untouched (of course) and when you send it to the other side it will arrive as expected.

We'll see if we can improve the getDump() method to avoid this corner case.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply