PDA

View Full Version : Ext.decode makes my XHR invalid?



darthwes
17 Jan 2011, 10:22 AM
So I've got a backend piece that wants to send back a list of errors when there is one/many.

Right now, I'm debugging this xhr being returned:



{"success":true,"results":"12-2011-fail-Upload Failed:<br\/>Error 14."}


First of all, I don't know why my "<br/>" was turned into "<br\/>" Any light on that?

Secondly, it's still valid (JSLINT confirms) json, but Ext won't parse it because (and this is my real problem) Ext thinks the "br\/>" is "br/="">" which is totally jacked up and I have no way of understanding why. So eval throws up and js loses his internal organs.

Anyone have any light they can shed on this for me? Why is my string getting converted 2 different ways? Who is converting it into an invalid string?

Thanks for your time.

mschwartz
17 Jan 2011, 11:58 AM
Ext.encode('<br/>')
""<br/>""


Not sure what language you're using, but something is adding the slash.

mschwartz
17 Jan 2011, 11:59 AM
http://jsonformatter.curiousconcept.com/

Says:


"<br \/>"

is not valid.

darthwes
17 Jan 2011, 12:13 PM
Thanks mschwartz, that clears up a lot of the confusion. Perhaps I've left some php ini directives (like magic quotes or something?) incorrectly configured? I'll let you know when/if I solve, thanks.

EDIT:


{"success":true,"results":"12-2011-fail-Upload Failed:<br\/>Error 14."}


is marked valid by http://jsonformatter.curiousconcept.com/