encodeURIComponent and urldecode removes slashes, why?

jacobblush

New Member
HelloI am using JSON.stringify for an array of arrays, and it returns this:\[code\]'[ ["<span pt=\"7.5\" idfont=\"Humnst777 Cn BT-Bold\">Javelin</span>","0","0"], ["<span idfont=\"Humnst777 Cn BT-Bold\">Javelin&co</span>","0","0"] ]';\[/code\]It is correct but i have to use encodeURIComponent (& present) to post this value with js.The problem is that when I get this data in POST from php with $boxes=json_decode($_POST['data']) it seems to remove slashes eg. pt=\"7.5\" -> pt="7.5" destroying the json object giving this result:\[code\]'[["<span pt="7.5" idfont="Humnst777 Cn BT-Bold" >Javelin</span>","0","0"]["<span pt="7.5" idfont="Humnst777 Cn BT-Bold" >Javelin&</span>","0","0"] ]';\[/code\]Does any one how to avoid this problem?thanks
 
Back
Top