XMLHttpRequest adding special character to $_POST
I'm using Extjs 4.0 to add a descprition to the database. In order to do that, I create an XMLHttpRequest and send the information through POST. My problem is that when I recieve the $_POST in my php file, the special character "​" has been added to the string. Here is my POST function.
function JS_SimplePOST(remoteUrl, parameters, values) {
var data = "";
for (i = 0; i < parameters.length; i++) {
data += parameters[i] + "=" + values[i] + "&";
}
data = data.slice(0, data.length - 1);
alert(data);
var xhr = getXMLHttpRequest();
xhr.open("POST", remoteUrl, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Content-length", data.length);
xhr.setRequestHeader("Connection", "close");
xhr.send(data);
}
This is a data example :
<span style="font-family: tahoma, arial, verdana, sans-serif; color:开发者_StackOverflow社区 rgb(0, 0, 0); "></span><font color="#ff00ff"><font face="tahoma, arial, verdana, sans-serif">asfasfasfdsfdsafsdfdsf</font><b><font face="tahoma, arial, verdana, sans-serif">asfasfasfasf</font><i><font face="tahoma, arial, verdana, sans-serif">asfasfasf</font><font face="'courier new'">asfasfasfasf</font></i></b></font>
And this is the $_POST["Description"] I get in my PHP file:
<span style="font-family: tahoma, arial, verdana, sans-serif; color: rgb(0, 0, 0); ">​</span><font color="#ff00ff"><font face="tahoma, arial, verdana, sans-serif">asfasfasfdsfdsafsdfdsf</font><b><font face="tahoma, arial, verdana, sans-serif">asfasfasfasf</font><i><font face="tahoma, arial, verdana, sans-serif">asfasfasf</font><font face="'courier new'">asfasfasfasf</font></i></b></font>
Finally I must add that the description comes from a HtmlEditor box in my page.
Thank you very much for you time and effort.
精彩评论