View Full Version : Ext.Ajax.request adding extra \ (special character)

16 Apr 2012, 1:36 PM
var textFieldText = "folder\file";

var postData = {
'call': 'some_command',
'param': textFieldText,

url: "/rest/request/" + restSession,
method: 'POST',
params: JSON.stringify( postData ),
headers : {
'Authorization' : 'Basic ' + newBase64.encode(username+':'+password)

The problem with this is that in the header's form data has folder\\file instead of folder\file. My guess is that it's happening somewhere within Ext.Ajax.request.

Why the extra \ ???
How do I avoid ext JS from adding an extra \ ?

Thank you in advance for the help!

16 Apr 2012, 1:42 PM
how eventListen_PostData its related to PostData ?
also did you check that wasnt JSON.stringify who set that extra \ ?

17 Apr 2012, 6:57 AM
Thank you!! You are totally correct, JSON.stringify() doesn't like special characters. What's a good option for allowing special characters like blackslashes?

params: JSON.stringify( "stuff\things" ),

I've also tried Ext.encode(), with the same results.

Another problem, "stuff\things" has \t, which creates a tab, which I don't want.

17 Apr 2012, 5:17 PM
did you try sending the string just like that ? like "stuff\things" ?
do you get any error in the server side ?

19 Apr 2012, 8:24 AM
I think the real problem lies when it's not a "string" but a variable pumped with text from a textfield.