encodeURIComponent will be encoded in Utf-8, under GBK encoding, can you encode it with GBK?
If you are still playing encodeuricomponent idea, then sorry, encodeURIComponent will only utf-8 code, and no other API to do other coding; but don't worry, look at the following:
encodeURIComponent, it is to convert Chinese, Korean and other special characters into utf-8 format of the URL encoding.
Escape encodes a Unicode value other than 0-255 by outputting the%u**** format, in other cases the Escape,encodeuri,encodeuricomponent encoding results are the same.
Haha, see hope? Yes, it is to use escape instead of encodeURIComponent method, but must note:
Escape does not encode 69 characters: *,+,-,.,/,@,_,0-9,a-z,a-z
There are 71 encodeuricomponent characters that are not encoded:!, ', (,), *,-,.,_,~,0-9,a-z,a-z
When you use escape, you must encode the plus sign, otherwise, when the content contains the plus sign, it will be translated into space by the server.
$.ajax ({
Url:ajaxurl,
Type: ' Post ',
DataType: ' HTML ',
timeout:20000,//Timeout Time setting
data:para,//parameter settings
Success:function (HTML) {
}
});
Ajax:function (s) {
Extend the settings, but Re-extend ' s ' So, it can be
Checked again later (in the test suite, specifically)
s = Jquery.extend (true, S, Jquery.extend (true, {}, jquery.ajaxsettings, s));
var jsonp, jsre =/=? (&|$)/g, status, data,
Type = S.type.touppercase ();
Convert data if not already a string
if (s.data && s.processdata && typeof s.data!== "string")
S.data = Jquery.param (S.data);
........
}
Jquery.param=function (a) {
var s = [];
var encode=function (str) {
Str=escape (str);
Str=str.replace (/+/g, "%u002b");
return str;
};
function Add (key, value) {
s[s.length] = encode (key) + ' = ' + encode (value);
};
//If a array was passed in, assume this is it's an array
//of form elements
if (Jquery.isarray (a) | | a.jq uery)
//Serialize the form elements
Jquery.each (A, function () {
Add (this.name, this.value);
});
//Otherwise, assume that it's an object of key/value pairs
Else
//serialize the Key/values
for (var J in a)
//If the ' is ' an array then the ' key names need to be repeated
if (Jquery.isarray (a[j))
JQ Uery.each (A[j], function () {
Add (j, this);
});
Else
Add (J, Jquery.isfunction (A[j])? A[j] (): A[j]);
//Return the resulting serialization
Return S.join ("&"). Replace (/%20/g, "+");
}